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

StackOverflow https://stackoverflow.com/questions/23530128

  •  17-07-2023
  •  | 
  •  

I'm trying to create a nuget package using certain MSbuild properties for the path to a file I want in my nuget package. 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).

In my .nuspec, I have something that looks like this:

<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. Similarly, if I hardcode the path to the file without using the MSbuild property, the package will be created with the file included.

I've tried using nuget 2.8.1 and 2.8.2, but it seems to be broken either way.

有帮助吗?

解决方案

Turns out this was a bug in nuget code, which was fixed after I posted the problem on codeplex. Link to the issue on codeplex: https://nuget.codeplex.com/workitem/4153

Updating nuget should fix the issue.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top