Question

I have a small c# library that wraps Dapper.net and I want to create a nuget package for this library. I've created a folder that contains the following:

Nuget-Package\
Nuget-Package\Package.nuspec
Nuget-Package\lib\
Nuget-Package\lib\DapperWrapper.dll

Here's the nuspec

<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
  <metadata>
    <id>GoDaddy.Data</id>
    <version>1.0.0</version>
    <authors>Owner Name</authors>
    <owners>Owner Name</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>I provide a fast and slim layer between your code and stored procedures that your application needs to use. This layer provides more straight-forward access to procs than straight ADO and less overhead than using Entity or Linq. It currently uses Dapper.Net to do some of this work.</description>
    <releaseNotes>Initial Release</releaseNotes>
    <copyright>Copyright 2014</copyright>
    <tags>ADO Dapper Proc "Stored Procedure"</tags>
    <dependencies>
      <dependency id="Dapper" version="1.13" />
    </dependencies>
  </metadata>
</package>

I then copy the resulting DapperWrapper1.0.0.0.nupkg over to my local nuget server.

After this I attempt to install it on a console application. I open a simple console application right click on references and say manage nuget packages. I find and select my package and select install and get the following error:

Attempting to resolve dependency 'Dapper (≥ 1.13)'.
External packages cannot depend on packages that target projects.

What am I doing wrong here?

Seems too simple to fail and yet I cant seem to find a good explanation of this error anywhere.

Was it helpful?

Solution

The answer can be found here. http://www.marcusoft.net/2011/12/creating-tools-only-nuget-package.html

Apparently nuget wont resolve dependencies unless you have both "lib" and "content" folders even if you're not using them.

Wow that's a bug IMO.

OTHER TIPS

See this nuget workitem: http://nuget.codeplex.com/workitem/595

You could try adding a files section to your nuget package, referencing the files in your project.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top