简体   繁体   English

当路径包含某些msbuild属性时,Nuget无法包含nuspec文件中列出的文件

[英]Nuget fails to include files listed in the nuspec file when paths contain certain msbuild properties

I'm trying to create a nuget package using certain MSbuild properties for the path to a file I want in my nuget package. 我正在尝试使用某些MSbuild属性为nuget包中想要的文件的路径创建nuget包。 However, if I use certain MSbuild pre-defined properties in the path, nuget fails to include them in the package (but does not throw any errors). 但是,如果我在路径中使用某些MSbuild预定义属性,则nuget无法将它们包括在包中(但不会引发任何错误)。

In my .nuspec, I have something that looks like this: 在我的.nuspec中,我看起来像这样:

<files>
   <file src="$MSBuildProjectDirectory$\..\..\Setup\CommonWebScripts\CreateIISSite.ps1" target=".\"/>
</files>

I can verify that the substitution is working because if I change the path to have an non-existent folder in it, nuget throws an error saying that the path is invalid. 我可以验证替换是否正常工作,因为如果我更改路径以在其中存在不存在的文件夹,则nuget会引发错误,指出该路径无效。 Similarly, if I hardcode the path to the file without using the MSbuild property, the package will be created with the file included. 同样,如果我在不使用MSbuild属性的情况下对文件的路径进行硬编码,则将使用包含的文件来创建程序包。

I've tried using nuget 2.8.1 and 2.8.2, but it seems to be broken either way. 我已经尝试使用nuget 2.8.1和2.8.2,但是它似乎都被破坏了。

Turns out this was a bug in nuget code, which was fixed after I posted the problem on codeplex. 原来这是nuget代码中的错误,当我在Codeplex上发布问题后,该错误已得到修复。 Link to the issue on codeplex: https://nuget.codeplex.com/workitem/4153 链接到Codeplex上的问题: https ://nuget.codeplex.com/workitem/4153

Updating nuget should fix the issue. 更新nuget应该可以解决此问题。

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

相关问题 强制 MSBuild 在 nuget.nuspec 文件中包含 Owners 元素 - Force MSBuild to include the Owners element in the nuget .nuspec file MSBuild,包括基于一组路径的文件 - MSBuild, include files based on a group of paths 如何在生成的 .nuspec 的 MSBuild NuGet 包中注入自定义依赖项 - How to inject a custom dependency in an MSBuild NuGet pack generated .nuspec MSBuild,属性和导入的文件 - MSBuild, properties and imported files 使用getter / setter类属性时,msbuild无法编译 - msbuild fails compiling when using getter/setter class properties 调用msbuild pack时如何在nuget包中包含本地DLL引用? - How to include a local DLL reference in to a nuget package when calling msbuild pack? MSBuild忽略已安装的nuget(NuGet 3),失败 - MSBuild ignores installed nugets (NuGet 3), fails 使用 Microsoft.TypeScript.MSBuild 时如何在 nuget 包中将 typescript 输出作为 staticwebassets 包含在内 - How to include typescript output as staticwebassets in nuget package when using Microsoft.TypeScript.MSBuild 通过MSBuild获取NuGet依赖库的绝对路径 - Get absolute paths to NuGet dependency libraries via MSBuild nuget包中的.targets文件-如何将内容文件包含到构建中 - .targets file within nuget package - how to include content files into a build
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM