When trying to install a package from our newly created private Nuget Feed i get the following error.
Could not install package 'GC.Timecode 1.0.0.3'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5.1', but the package does not contain any assembly references or content files that are compatible with that framework.
The Nuget package also targets 4.5.1. (Screenshot take from Nuget Package Explorer)
The Nuget Package is created by Octopack via On premises TFS, and then published to a private Proget Server
Nuspec file looks like this
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>GC.Timecode</id>
<version>1.0.0.3</version>
<authors>user</authors>
<owners>user</owners>
<licenseUrl>http://example.com</licenseUrl>
<projectUrl>http://example.com</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>The GC.Timecode deployment package, built on 25/01/2016</description>
<releaseNotes />
</metadata>
</package>
Contents of Package
What's going on here?
Switch to the Browse tab, search for the package name, select it, then select Install). For all packages, delete the package folder, then run nuget install . For a single package, delete the package folder and use nuget install <id> to reinstall the same one.
Enable package restore by choosing Tools > Options > NuGet Package Manager. Under Package Restore options, select Allow NuGet to download missing packages. In Solution Explorer, right click the solution and select Restore NuGet Packages.
Slippery Pete fixed this problem for me.
The first time I tried to install my Assembly I got:
Could not install package 'Package Name'. You are trying to install this >package into a project that targets '.NETFramework,Version=v4.6.1', 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.
After ensuring my Assembly within the Nuget package was in the 'lib\net45' folder, I still got the error!
However after going to Tools->Options->Nuget->General and clearing the cache, the problem was solved.
Make sure your nuspec file contains a 'lib/net45' target
<package>
<metadata>
...
</metadata>
<files>
<file src="bin\Release\*.*" target="lib/net45" />
</files>
</package>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With