适用于 .Net 2.0 和 msbuild 2.0 的 Octopack

Octopack for .Net 2.0 and msbuild 2.0

我正在设置一些项目来构建 NuGet 包并推送到 NuGet 服务器,以便以后可以由 Octopus Deploy 使用。

一切都很好,直到我需要将相同的流程应用于遗留项目。错误是:

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.

现在我知道 OctoPack 不是为 .Net 2.0 构建的,但只是想知道是否有人 hit/solved 这个问题。

您能否将应用程序的构建目标从 2.0 更改为更新的版本?如果是这样,我会升级我的应用程序,而不是寻找降级版本的 Octopack。

或者,you can use NuGet.exe 创建包而不是使用 OctoPack。我实际上更喜欢 OctoPack,但 NuGet.exe 不会关心您的 .NET 版本。

我最终修改了 Octopack 代码以与 .Net 2.0 和 MSBuild 2 一起使用,它成功地应用于我们在 CruiseControl 服务器上打包的所有 .Net 2.0 和 3.5 应用程序。

如果有人遇到类似情况,这里是 the amended code(从原始 Octopack 分叉)