简体   繁体   English

Nuget 3 - Octopack - 错误的框架目标错误

[英]Nuget 3 - Octopack - Wrong Framework Target error

I'm getting mad trying to solve this one. 我正试图解决这个问题。 My environment: 我的环境:

  • VS2015 VS2015
  • Nuget extension 3.3.0.167 Nuget扩展3.3.0.167
  • Octopack package 3.0.45. Octopack包3.0.45。

When I run the following command below, the package is correctly generated: 当我在下面运行以下命令时,正确生成了包:

 v4.0.30319\msbuild PackagingTest.sln /t:Rebuild
/p:Configuration=Release /p:RunOctopack=true
/p:OctoPackPackageVersion=1.1.1/p:OctoPackPublishPAckageToFileShare=C:\Packages

But when I try to Install the package in a second project I get this exception: 但是当我尝试在第二个项目中安装软件包时,我得到了以下异常:

Could not install package 'PackagedLibrary 1.1.1'. 无法安装包'PackagedLibrary 1.1.1'。 You are trying to install this package into a project that targets '.NETFramework,Version=v4.5', but the package does not contain any assembly references or content files that are compatible with that framework. 您正在尝试将此软件包安装到以“.NETFramework,Version = v4.5”为目标的项目中,但该软件包不包含与该框架兼容的任何程序集引用或内容文件。 For more information, contact the package author. 有关更多信息,请与软件包作者联系。

  • Both are targeting the same framework (4.5). 两者都针对相同的框架(4.5)。
  • If you extract the library from the package and reference it, there's nothing weird going on there. 如果从包中提取库并引用它,就没有什么奇怪的了。
  • If you add the package from VS2013, it works perfectly. 如果你从VS2013添加包,它可以很好地工作。

I've notice Octopack version (dowloaded from the v3 endpoint https://api.nuget.org/v3/index.json ) has Nuget.exe v.2.8, instead of the 3.xxx that it should. 我注意到Octopack版本(从v3端点https://api.nuget.org/v3/index.json下载 )具有Nuget.exe v.2.8,而不是它应该的3.xxx。 So I've tried to manually replace the nuget.exe file to generate the package, with no changes. 所以我试图手动替换nuget.exe文件来生成包,没有任何更改。

Any clues of what am I missing? 我错过了什么线索?

Thanks in advance 提前致谢

As far as I am aware using Octopack will generate a NuGet package (.nupkg) that can be used for OctopusDeploy only. 据我所知,使用Octopack将生成一个NuGet包(.nupkg),只能用于OctopusDeploy。 It does not generate a NuGet package that can be used by NuGet in Visual Studio. 它不会生成可由Visual Studio中的NuGet使用的NuGet包。

Whilst Octopus Deploy uses .nupkg files the structure of the files in the .nupkg file are different. 虽然Octopus Deploy使用.nupkg文件,但.nupkg文件中的文件结构却不同。 For the .nupkg to be possible to install into a .NET 4.5 project it would need the assembly inside a lib\\net45 directory. 为了能够将.nupkg安装到.NET 4.5项目中,需要在lib \\ net45目录中进行组装。 If you look inside your .nupkg it will most likely not have this directory but will probably have the assemblies just in the root of the .nupkg. 如果您查看.nupkg内部,很可能没有此目录,但可能只有.nupkg根目录中的程序集。

If you want to use the .nupkg file with NuGet you should look at using NuGet.exe to genreate the .nupkg file. 如果要将.nupkg文件与NuGet一起使用,则应该使用NuGet.exe来生成.nupkg文件。

The reason is probably works with Visual Studio 2013 is that it is treating it as a solution level NuGet package which are not currently supported in Visual Studio 2015. 原因可能与Visual Studio 2013一起使用的是它将它视为解决方案级别的NuGet包,Visual Studio 2015目前不支持它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM