Custom NuGet package not installing in wix project

Viewed 178

I generate a NuGet that is is just a number of redist files that I want to use in one of my projects. If I install it in a C# or C++ projects, it works. But when I try to install it in a wixproj project and I get the following message: Could not install package 'package-1.0.0'. You are trying to install this package into a project that targets 'Unsupported,Version=v0.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

I generate the package through a TeamCity task (using NuGet 5.6.0). When trying to generate the package with a NuGet CLI 5.8.1, I get the following warning:

*WARNING: NU5128: Some target frameworks declared in the dependencies group of the nuspec and the lib/ref folder do not have exact matches in the other location. Consult the list of actions below:

  • Add a dependency group for native0.0 to the nuspec*

Looked at https://docs.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu5128, one of the solutions was trying a dependencies group targetFramework, (I used "native0.0") with no success. My nuspec is as follows:

<?xml version="1.0"?>
 <package>
  <metadata>
    <id>package</id>

    <version>1.0.0</version>
    <authors>package</authors>
    <owners>owner</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>my package</description>
    <copyright>© 2021 company, Inc</copyright>
    <tags>native</tags>
  </metadata>
  <files>
    <file src="downloads\Folder\win32.vs2017\file1.lib" target="lib\native\lib\win32.vs2017\" />
    <file src="downloads\Folder\win32.vs2017\file1-debug.lib" target="lib\native\lib\win32.vs2017\" />
    <file src="downloads\Folder\Include\**" target="lib\native\include\" />
    <file src="build\package.props" target="build\native" />
  </files>
</package>

And my props file

<Project>
 <PropertyGroup>
   <MyVersion>1.0.0</MyVersion>
 </PropertyGroup>
</Project>

I can install other NuGet packages into wixprojects, so how I configure mine to work? Thanks.

1 Answers

OK I found it, the issue lies at the line

    <file src="build\package.props" target="build\native" />

changing target to "build\" allows the NuGet to be loaded to any project type, included WixProj. Note that the NU5128 warning still exists though, but not an issue for me.

Related