Package Created using Package Explorer won't install

May 27, 2011 at 8:31 PM

I am trying to create an internal NuGet Repository and Package.  I have the server running on my local machine for now and tried to create a new package using NuGet Package Explorer.  I customized the metadata and then added a lib to package contents.  The goal of this package is to add the required DLLS to a project for it to connect to oracle "Standalone". 

What I really want is to add all the dlls (there's 7 of them) to the project as "Content" with "Copy To Output Directory" set to Always for all of them.  One additional DLL needs to be added as a Reference and made to "Copy Local".

Currently, I have only added all 8 to the "lib" in the package contents.  The problem i'm having is that when i try to add the package reference, it says it was successful, then rolls back with this error: "Please make sure that the file is accessible, and that it is a valid assembly or COM component." 

Any Ideas?

May 27, 2011 at 8:38 PM
Edited May 27, 2011 at 8:41 PM

I suspect the 7 .dlls are not valid .net assemblies. Everything under 'lib' will be added as reference to the project by nuget. Hence the error.

What you want to do is put the 7 assemblies under the 'Content' folder, and then have a install.ps1 script to mark them as 'Copy to Output directory'. Admittedly, we could make this task easier in a future version, but that's what you need to do currently.

May 27, 2011 at 8:44 PM

I'm trying to add it to a Windows Service project. 

I don't see why i can't share the package file, but how do i attach it?  Or should i just copy/paste the nuspec file and folder structure?

May 27, 2011 at 8:55 PM

Sorry, I editted my previous reply :) Can you try the steps I describe after edit?

May 27, 2011 at 9:00 PM

Tried that. 

Got the error "Failed to download package correctly. The contents of the package could not be verified." now.  Also, where can i find a reference or examples on the ps1 files and what commands can use in them?  Does the install.ps1 go in Content as well?

May 31, 2011 at 5:15 PM

I've also tried deploying the project to an IIS6 server on Win2003.  I am able to see and download the packages, but when it tries to install, it get the same "Failed to download package correctly. The contents of the package could not be verified." error.

May 31, 2011 at 5:27 PM

Can you create a bug and then attach your package file in the bug report?

May 31, 2011 at 5:28 PM

Also, if you use Fiddler to monitor traffic, what does it show in the Fiddler trace?

May 31, 2011 at 7:00 PM

Really weird.  I installed fiddler2 and all it did was pull the file down as expected.  The strange thing is, this time, the install worked.  I still need to find how to write a ps1 file to set assemblies to "Copy to Output Directory" though.

May 31, 2011 at 7:15 PM
Edited May 31, 2011 at 7:16 PM

I suspect the reason it's working through Fiddler2 but not directly is that you haven't set the Mime type for the .nupkg extension. Try setting it to 'application/octet-stream' in your IIS server.

Here is an example of the ps1 file that can set assemblies to "Copy to Output Directory":

param($rootPath, $toolsPath, $package, $project)

$project.ProjectItems.Item("myassembly.dll").Properties.Item("CopyToOutputDirectory").Value = 1

Setting the value to 1 means "Copy Always", or set it to 2 if you want "Copy if newer"

May 31, 2011 at 9:21 PM

That took care of everything. 

Thanks!