-
Notifications
You must be signed in to change notification settings - Fork 374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nuke isn't packing referenced tools with global tool #437
Comments
Yes, I've encountered the same issue. This is the behavior of NuGet. See NuGet/Home#9132 (comment) I've achieved it by repacking the NuGet package after pack. What I did I created a So, I can inject some properties into Here is how I did it:
var nugetPackage = Glob.Files(ArtifactsDirectory, "*.nupkg").NotEmpty().Single();
var propsFile = Glob.Files(BuildAssemblyDirectory, "*.props").NotNull().Single();
var propsContent = XDocument.Load(BuildAssemblyDirectory / propsFile);
var packageReferencesToAddToNuspec = propsContent.Descendants("PackageReference").Where(x => x.Attribute("Pack").Value == "True");
var extractedPackageDir = TemporaryDirectory / nugetPackage;
UncompressZip(ArtifactsDirectory / nugetPackage, extractedPackageDir);
var nuspecFile = Glob.Files(extractedPackageDir, "*.nuspec").NotEmpty().Single();
var nuspecDocument = XDocument.Load(extractedPackageDir / nuspecFile);
var namespaceName = nuspecDocument.Root.GetDefaultNamespace().NamespaceName;
var dependenciesElementName = XName.Get("dependencies", namespaceName);
var groupElementName = XName.Get("group", namespaceName);
var groupElement = nuspecDocument.Descendants(dependenciesElementName).Single().Element(groupElementName);
foreach (var packageReference in packageReferencesToAddToNuspec)
{
var dependencyElement = new XElement(XName.Get("dependency", namespaceName));
dependencyElement.Add(new XAttribute("id", packageReference.Attribute("Include").Value), new XAttribute("version", packageReference.Attribute("Version").Value), new XAttribute("exclude", "All"));
groupElement.Add(dependencyElement);
}
nuspecDocument.Save(extractedPackageDir / nuspecFile);
DotNetPack(_ => _
.SetProject(MainProject)
.SetProperty("NuspecFile", extractedPackageDir / nuspecFile)
.SetOutputDirectory(ArtifactsDirectory)
.SetProperty("NoWarn", "$(NoWarn)%3BNU5048")); |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description
http://www.nuke.build/docs/sharing-builds/global-tools.html
Actually after dotnet pack we have only the tool packed without the referenced packages
Steps to reproduce
2 dotnet pack
Relevant log output
The text was updated successfully, but these errors were encountered: