1

My project structure is: The main project is .NET framework 4.8, and the library develops by C++/CLI. I can add the file reference directly, it can work now.

For some reason, we don't want to reference the file, so we want to use NuGet to get the library.

I have published the package to our private NuGet feed, but when I install the package from NuGet, it shows the error:

Could not install package 'MyLib 1.0.3'. You are trying to install this package into a project that targets '.NETFramework, Version=v4.8', 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.

PS: I have set the ".NET Framework Target Version" to "v4.8".

This is my .nuspec file:

<?xml version="1.0"?>
<package >
  <metadata>
    <id>MyLib</id>
    <version>1.0.3</version>
    <authors>MyCompany</authors>
    <owners>MyCompany</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>lib for Windows</description>
    <releaseNotes>This is the test publish.</releaseNotes>
    <copyright>Copyright 2019</copyright>
    <tags>lib native</tags>
  </metadata>
</package>

And it just contains one file:

\build
    \net48
        \MyLib.dll
2
  • Show us the .nuspec file you created and you'll surely get somebody to point the finger and exclaim "there!" Commented Sep 25, 2019 at 10:25
  • I have resolved it. I found the lib.dll should be placed into "lib". Commented Sep 26, 2019 at 2:06

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.