Home: Tools-only package can not be installed

Created on 11 Nov 2015  路  9Comments  路  Source: NuGet/Home

I have created a resource-only package, which contains single exe file. When I attempt to install it into the project, it complains

Could not install package 'consul-bin 5.2.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.

I do not understand this check. If there is no assemblies, than there is no incompatibilities. Why this condition is treated as an error?

Nuspec file to generate package:

<?xml version="1.0"?>
<package >
  <metadata>
    <id>consul-bin</id>
    <version>5.2.0</version>
    <authors>vchekan</authors>
    <owners>vchekan</owners>
    <licenseUrl>https://github.com/hashicorp/consul/blob/master/LICENSE</licenseUrl>
    <projectUrl>https://www.consul.io/</projectUrl>
    <iconUrl>https://www.consul.io/assets/images/[email protected]</iconUrl>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>Consul.exe file. Is used to simplify integration testing where local Consul server is required for duration of the test.</description>
    <copyright>NTent Copyright 2015</copyright>
    <tags>consul</tags>
  </metadata>
  <files>
    <file src="consul.exe" target="tools"/>
  </files>
</package>

It would make sense to limit this package to windows-only platforms, but documentation does not says how to do it. Perhaps it is not possible at all?

2 NotRepro Bug

Most helpful comment

@NameOfTheDragon you should be able to put a _._ file in the folder, it does not get added to your project.

All 9 comments

can you provide more details?

Version of visual studio
Version of NuGet extension
What project type you are installing this package into

@yishaigalatzer

Visual Studio: 2015 Professional
Nuget extension: 3.2.60914.10516
Installing into C# console app project, target framework: 4.5

It seems the relevant code is here:
https://github.com/NuGet/NuGet.Client/blob/a188fa5df8efe38a4a1bac6fdf0af352bf63edf3/src/NuGet.Core/NuGet.ProjectManagement/Projects/MSBuildNuGetProject.cs#L234

related to solution level packages, we should enable installing these packages into a project.

This is actually something of a showstopper. I think you should make it higher priority. I already have two affected packages and it also affects Microsoft.CodeContracts.
As a workaround I found I could just put a dummy file in the content/net folder. Of course the file then gets added to my projects, but at least the package then installs.

@nameofthedragon this is as high pri as it gets. 3.3 is done, so pri 1 in 3.4 is it.

When it comes to your package you might be able to get away with an empty folder for a dependency (_._) not sure though

@NameOfTheDragon you should be able to put a _._ file in the folder, it does not get added to your project.

@yishaigalatzer can you provide an example of how to "put a . file in the folder" please?

I tried to specify a .file like <file src=".dummy" target="content" /> but NuGet 3.5.0.1938 does not include that file in the package; the file exists and NuGet.exe succeeds without error.

However, adding an empty folder works as expected.
<file src="dummy" target="content" />

Thank you!

Thanks for reporting this issue. We have not been able to reproduce this issue. If you are still able to reproduce this with the latest NuGet version, please provide additional steps.

Hello,
I am facing this issue right now. Could you please help me on that?
I need to include a .file in the package, but when I try to run nuget pack, nuget shows me this error: String cannot be empty. Parameter name: entryName

Was this page helpful?
0 / 5 - 0 ratings