Domanda

I have a project (A.csproj) which references an assembly (B.DLL) that is not part of the .NET framework.

Packing the project with nuget pack a.csproj effectively builds the package but when testing the package it doesn't contain the B.DLL and obviously it is not added as a reference.

I've tried to use nuget spec but nothing related to that reference could be found in the generated nuspec file.

I've also tried to use the Create New NuGet Package From Project After Each Build 1.7.3 package but it didn't help.

What are the steps needed for including and referencing an assembly in a NuGet package ?

È stato utile?

Soluzione

if you need fine-grained control over the layout and content of your NuGet package, then you should create a nuspec file and use that to create the package. Then you can add files with the following syntax, for example:

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
   <metadata schemaVersion="2">
     ...
   </metadata>
   <files>
     <file src="Foo.dll" target="lib\net45" />
     ...
   </files>
</package>

Altri suggerimenti

Have you tried using the -IncludeReferencedProjects attribute with your nuget pack statement?

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top