NuGet / Home

Repo for NuGet Client issues
Other
1.5k stars 252 forks source link

Allow metadata/reference be specified to be used by the Pack target #6290

Open kkm000 opened 6 years ago

kkm000 commented 6 years ago

Details about Problem

NuGet product used (NuGet.exe | VS UI | Package Manager Console | dotnet.exe): dotnet\sdk\2.0.3\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets and NuGet.Build.Tasks.Pack.
VS version 15.4.5, MSBuild 15, full framework.


Explicit assembly references are not apparently supported by the NuGet Pack task. In fact, the exact scenario documented there does not seem to be supported. I am attempting to package a Code Contracts reference assemblies with the main libraries (per framework). While packaging itself is possible with some effort, this is entirely fruitless, as without the reference metadata the contract libraries are added as normal references on package import. Bummer, back to .nuspec and Exec'ing the command line nuget.exe!

I just checked out and quickly searched the code, and, while it is obvious that NuGet.Packaging.PackageBuilder indeed supports adding references through its PackageAssemblyReferences property, this property does not seem to be touched anywhere in NuGet.Core/NuGet.Build.Tasks.Pack.

Is this a real design omission, or am I just missing a way to set references through the MSBuild packaging task and targets? If it's not there, it should be fairly straightforward to support through either some manifest metadata on the BuildOutputInPackage collection, or through an additional property of the task.

rrelyea commented 5 years ago

@kkm000 - sorry we haven't been able to get to this yet. one question, i'm assuming that the only to get this in "nuget pack" is to provide the .nuspec, right? or is there something more automatic in our old pack code.