问题描述
当尝试从我们新创建的私有 Nuget Feed 安装包时,我收到以下错误.
When trying to install a package from our newly created private Nuget Feed i get the following error.
无法安装包GC.Timecode 1.0.0.3".您正在尝试将此包安装到以.NETFramework,Version=v4.5.1"为目标的项目中,但该包不包含任何与该框架兼容的程序集引用或内容文件.
Could not install package 'GC.Timecode 1.0.0.3'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5.1', but the package does not contain any assembly references or content files that are compatible with that framework.
Nuget 包还针对 4.5.1.(来自 Nuget 包资源管理器的屏幕截图)
The Nuget package also targets 4.5.1. (Screenshot take from Nuget Package Explorer)
Nuget 包由 Octopack 通过本地 TFS 创建,然后发布到私有 Proget 服务器
The Nuget Package is created by Octopack via On premises TFS, and then published to a private Proget Server
Nuspec 文件如下所示
Nuspec file looks like this
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>GC.Timecode</id>
<version>1.0.0.3</version>
<authors>user</authors>
<owners>user</owners>
<licenseUrl>http://example.com</licenseUrl>
<projectUrl>http://example.com</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>The GC.Timecode deployment package, built on 25/01/2016</description>
<releaseNotes />
</metadata>
</package>
包装内容
这是怎么回事?
推荐答案
问题是 Octopack 默认只会复制现有的文件夹结构,而 Nuget 会将您的 dll 打包到 lib 文件夹中.
The problem was that Octopack will by default just replicate the existing folder structure, whereas Nuget will package your dll into a lib folder.
对于懒惰的人,您可以使用这个包来获取在每个构建上构建的 nuget 包
For the lazy, you can use this package in order to Get a nuget package built on every build
https://www.nuget.org/packages/CreateNewNuGetPackageFromProjectAfterEachBuild/
这篇关于Nuget包安装失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!