Home > Uncategorized > Issue: Assembly outside lib folder. (NuGet)

Issue: Assembly outside lib folder. (NuGet)

NuGet seems to be a great way to get windows developers to use your code, it makes it easy to package up an assembly to be used in another project. Seconds after uploading, I started to get developers downloading my code.

Here was a problem that I hit when I tried to package my assembly, there may be a better solution, but this worked for me.

I created a boiler-plate NuSpec file from my DLL by running

nuget spec MyAssembly.dll

I had to open the nuspec file in notepad, and edited the fairly obvious fields, like URL description, etc. Then, I went to pack the nuspec and dll together with this command:

NuGet Pack YourPackage.nuspec

However, I then got a warning:

WARNING: 1 issue(s) found with package ‘xxxx.dll’.

Issue: Assembly outside lib folder.
Description: The assembly ‘xxx.dll’ is not inside the ‘lib’ folder
and hence it won’t be added as reference when the package is installed into a project.
Solution: Move it into the ‘lib’ folder if it should be referenced.

The nupkg file was created, and I uploaded it to nuget.org, however, when I tried to download this again, using

PM> Install-Package xxxxx.dll
Installing ‘xxxxx.dll 1.0.0’.
Successfully installed ‘xxxx.dll 1.0.0’.

There was no reference added to my project, so, I couldn’t access the assembly.

So, after reading a bit, I edited my nuspec file, and added this node in the metadata

<references>
<reference file=”xxxx.dll” />
</references>

created a lib folder, and copied the dll into it. – and changed the version number

I repacked, and re-uploaded the nupkg, and when I downloaded it again, I got a reference automatically added to my test project.

And it’s all live on https://www.nuget.org/packages/OfflineAdvertsLib.dll

Advertisements
Categories: Uncategorized
  1. jeffwalkercoderanger
    October 22, 2015 at 3:11 pm

    The correct way to fix this would be to change the files element to place the dll inside the lib directory. You should not need the references element for this.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: