Octopack for .Net 2.0 and msbuild 2.0

625 views Asked by At

I was setting up number of projects to build NuGet packages and push onto NuGet server, so it could be later used by Octopus Deploy.

All was fine until I needed to apply the same process to legacy projects. The error was:

error MSB4062: The "OctoPack.Tasks.CreateOctoPackPackage" task could not be loaded from the assembly ...\OctoPack.Tasks.dll. Could not load file or assembly 'file:///...\OctoPack.Tasks.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. Confirm that the declaration is correct, and that the assembly and all its dependencies are available.

Now I understand that OctoPack was not built for .Net 2.0, but just wonder if anyone hit/solved that problem.

2

There are 2 answers

0
Alex M On BEST ANSWER

I ended up amending the Octopack code to work with .Net 2.0 and MSBuild 2, which is successfully applied to all our .Net 2.0 and 3.5 applications being packaged on the CruiseControl server.

If someone is in a similar situation here is the amended code (forked from the original Octopack)

1
Fenton On

Are you able to change the build target of the application from 2.0 to something more recent? If so, I would upgrade my app, rather than look for a downgraded version of Octopack.

Alternatively, you can use NuGet.exe to create packages rather than using OctoPack. I actually prefer OctoPack, but NuGet.exe wouldn't care about your .NET version.