Home: Content only packages

Created on 17 Oct 2016  路  4Comments  路  Source: NuGet/Home

Nuget complains on installing _content only_ packages that are created without any assembly to a reference. The package is created from a _convention-based working directory_ with only a _build_ folder. The same problem seems to occur with a _content_ folder only (reference).

The installation (NuGet Package Manager for VS 2015 v3.4.4.1321) fails with an error like:

Install-Package : Could not install package 'My-content-only-package 1.0.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5', 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.

The solution is to add an empty _lib_ folder to the root package directory. This is not obvious (no error or warning while packing) and a little cumbersome and therefore I would treat that behavior as a bug.

Restore Bug

Most helpful comment

Yeah, I found out I needed to have the files in a folder named "content" for it to work :) Thanks!

All 4 comments

Any news on this?

Content and Build are both counted as assets. If you are seeing the error above it means that there are zero files in the package that apply to your target framework.

Please share what version of NuGet you are using, the project Target Framework, and the package if you are seeing different behavior.

Yeah, I found out I needed to have the files in a folder named "content" for it to work :) Thanks!

This is fixed in 4.0.0, the build folder is now counted as compatible.

Was this page helpful?
0 / 5 - 0 ratings