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