Auto nesting props / targets files not working on native C ++ project

I am using automatic package restore in NuGet v2.8.50506.491 with Visual Studio 2013.

I added a build folder to my package with a .props {package ID} .props file. However, the file does not appear to be injected into vcxproj during restore. The package and all of its contents are restored correctly, but none of the definitions are visible in the vcxproj properties. This is to be expected if data nesting occurs in memory, but the build failed due to paths that are well defined in props that were not inherited.

If I add an explicit link to the props file in my local package repository, the project builds successfully, so there is no problem with the paths in the props.

I've also tried adding props to the "native" subfolder under the assembly, also to no avail.

Extract from nuspec:

<file src="build\MyPackage.targets" target="build\MyPackage.targets" />

      

I also tried the targets file instead of / as well as the props file, but that doesn't work either.

I must add that I have defined Nuget.config in sln folder with absolute path to my package repository:

<config>
  <add key="repositoryPath" value="C:\Packages" />
</config>

      

+3


source to share


2 answers


I had this problem today and eventually figured out that the names of my .nuspec and .targets files were different from my package ID, which seems to be the problem. Rename the .nuspec and .targets files to match the package ID that NuGet launches correctly in vcxproj. I'm not sure which of the two files was the problem, or if it was, but now it works correctly when all three names match.



+1


source


Including links .targets

and .props

only happens when you install the NuGet package. This is the same as in .NET projects where assembly references are only generated when the package is installed.



Later, when you build the project, the package restore engine simply downloads and extracts the NuGet package so that previously referenced .target / .props / assembly references become valid references.

0


source







All Articles