Reputation: 1425
When I install my custom NuGet package it works, but the output window in VS shows messages like it tried to add the files twice and they already existed. Output is further down in this post.
I have a NuGet private repository on a server here that is working to host our gallery. Installs and uninstalls are working, even though the output window shows the messages below. I am curious about the <files>
tag in the spec file and if there's a different way I need to do this. I have tried multiple ways based on the documentation. My version is up to date installed from the NuGet site.
From the site: The latest version of the nuget.exe command-line tool is always available from http://nuget.org/nuget.exe
Specifying files to include in the package
The output window shows things like this on Install-Package CustomNuGet:
The item /Plugins/CustomNuGet/CSS/custom.css already exists.
The item /Plugins/CustomNuGet/Scripts/custom.js already exists.
The item /Plugins/CustomNuGet/Views/custom.cshtml already exists.
The output window shows things like this on Uninstall-Package CustomNuGet:
The item /Plugins/CustomNuGet/CSS/custom.css could not be found in your workspace.
The item /Plugins/CustomNuGet/Scripts/custom.js could not be found in your workspace.
The item /Plugins/CustomNuGet/Views/custom.cshtml could not be found in your workspace.
I have created a custom Nuget package using the command line tools. The folder looks like this:
/CustomNuGet
CustomNuGet.nuspec
CustomNuGet.0.1.1.nupkg
/content
/lib
CustomNuGet.dll
/Plugins
/Views
custom.cshtml
/Scripts
custom.js
/CSS
custom.css
The spec file was created using: nuget spec
and the package nuget pack
in the root CustomeNuGet folder per the documentation. Here is the spec file:
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>CustomNuGet</id>
<version>0.1.1</version>
<authors>CustomNuGet</authors>
<owners>CustomNuGet</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>CustomNuGet</description>
<tags>CustomNuGet</tags>
<references>
<reference file="CustomNuGet.dll" />
</references>
<dependencies>
<dependency id="WebActivatorEx" version="2.0.0" />
</dependencies>
</metadata>
<files>
<file src="content\lib\CustomNuGet.dll" target="lib"/>
<file src="content\Plugins\**" target="content\Plugins" />
</files>
</package>
I didn't see any posts about this exact issue so hopefully others have had this happen and it's only a setting I missed.
Upvotes: 22
Views: 949
Reputation: 6557
This can happen if you deleted .dll reference manually instead of using uninstall-package to remove it through console. Check packages.config file, package you're trying to install is probably still listed there. You will have to delete it from that config file and save changes. After you did that, try installing package again and it should work.
Upvotes: 1