-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
dotnet pack doesn't let me provide my own nuspec #5525
Comments
The first three points are bugs and will be (most likely) fixed. The last one will be fixed when the consumer of your package uses the lastest NuGet client. Otherwise, you're always able to specify multiple frameworks for your project with their own set of dependencies. |
Has there been any progress on this issue? I really would like to provide my own Nuspec file also, so that the Authors and other information is correct. |
preview 3 includes a new |
1.0.0-rc3-004530 released on 1/20/17 - |
@waynebrantley Nuget team removed 'dotnet nuget pack'. See NuGet/Home#4254 for a request to bring back this functionality. |
@natemcmaster Yeah, I saw that...fine with it being gone. However, the 'pack' command on dotnet should use nuspec files! |
"dotnet-pack is going to be replaced by nuget pack" - https://github.com/dotnet/cli/issues/2893 And here I thought dotnet pack was intended to replace nuget pack. This tooling thrash is bonkers! Okay, so as of April 23, 2017, should we be using nuget pack or dotnet nuget pack? If we use dotnet pack, is supporting separate nuspec files planned? Ultimately, I'm wondering how you'd go about specifying you'd like the spec to generate dependencies with ranges (e.g. <dependency id="System.Logging" version="[1,2)" />). |
Is there an update on this? Need to be able to specify max version for a dependency, and it looks like there isn't a way to do this. Edited: apparently you can use version specs in csproj file directly, so nuspec shouldn't be required for my scenario. |
You can use |
The replacement tokens need to be created manually when using |
@dasMulli Great, thanks! |
You can provide MSBuild Command properties (Nuget Metadata properties) such as NuspecFile: dotnet pack <path to .*proj file> /p:NuspecFile=<path to .nuspec file> |
@dasMulli That was immensely helpful, thanks. |
FWIW (and for future googlers, as google Working example here: https://github.com/mattfrear/Swashbuckle.AspNetCore.Examples/blob/master/src/Swashbuckle.AspNetCore.Examples/Swashbuckle.AspNetCore.Examples.csproj |
@mattfrear Hi Matt. Can't remember how long I wasted being honest. I haven't got the scripts in front of me but basically I parameterised the csproj. That said, the end result is the same and in hindsight I should have used the csproj directly, to my recollection there was no reason I couldn't do that. At the time I was just using nuspec to drive a convention in our build scripts. |
@dasMulli Nice solution, though one minor bug (not in your case). When having special characters like &, they need to be re-encoded. In my case I fixed it with a dirty replace: <NuspecProperties>$(NuspecProperties);authors=$(Authors.Replace("&", "&amp;"))</NuspecProperties> |
@ljw1004 I just ran into the same, literally today, and it is STILL incorrect. Would be nice to at least specify your own In my case I've got things like: <id>$id$</id>
<title>$id$</title>
<owners>$author$</owners> But Note that I am leveraging the |
@mattfrear I think you may be on to something there. I don't mind the tooling comprehension, but TBH, it's one more stack I have to learn in the shifting sand of tooling changes. As contrasted with, I'd like for my packaging concerns to be consistent with prior versions and maintain some level of loose coupling at the tooling integration level. @dasMulli This is a marginally acceptable workaround, IMO, as it is just one more thing I have to be concerned with migrating projects forward. I think that the |
Question, @mattfrear, where are the |
the properties are documented at the NuGet pack and restore as MSBuild targets document. I do think that this is hard to find since you need to know what you're looking for (msbuild targets) ((and @guardrex pointed me to it a few months ago)).. cc @kraigb maybe @mwpowellhtx just out of curiosity (I don't work for MS/NuGet): are you upgrading projects from "classic" csproj to new sdk-style csproj or upgrading from packages.config to PackageReference? |
@dasMulli Exactly. From desktop .NET Framework into the world of .NET Standard. It's something of a paradigm shift, and I've been a bit hesitant to get started on that path, not least of which is all the shiny nuance that I have to sift through, never mind lack of documentation in much of the online docs, i.e. Roslyn documentation. But that said, so far so good. Digestion is a slow, time consuming process. |
@mwpowellhtx to answer your question, I linked to the page that I found where the NuGet properties in the .csproj is documented, in my original answer. The page is here https://docs.microsoft.com/en-us/dotnet/core/tools/csproj#nuget-metadata-properties |
PS, if there are doc matters that need to be addressed, please open a new issue on https://github.com/NuGet/docs.microsoft.com-nuget because docs folks don't monitor closed product issues. |
How are you supposed to specify the nuget package icon when using dotnet pack? The docs are useless on this point |
Here is an example <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<PackageIconUrl>https://raw.githubusercontent.com/NuGet/Media/master/Images/MainLogo/256x256/nuget_256.png</PackageIconUrl>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
</Project>
https://github.com/NuGet/NuGet.Client/blob/1123779dd300afb48ae6d6d61fc69eaf9469aec1/build/config.props |
Could anyone give me a hint: which one of
Isn't it a bit insane? O_o |
That works fine until you decide you want to include an icon and find that |
There is one: https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets#packing-an-icon-image-file Those docs don't seem to be up to date. Created an issue for that. |
So it seems you still cannot feed a .nuspec file to |
You should file an issue on nuget/home for this or see if they have one there already. Odds are that they already have a bug tracking this ask. |
But nuget pack allows to provide a nuspec file, it's dotnet pack that doesn't. |
The nuget experience in dotnet is owned by nuget.client dotnet packing a nuspec is already supported https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets#packing-using-a-nuspec. What's not supported is packing a standalone nuspec file, without a project NuGet/Home#4254 |
…an no longer be built via nuget pack, the project references the nuspec file and is packed during built time. Replaced tokens in nuspec file as they dont work if dotnet pack or msbuild -t:pack is used. More info / conversation on this topic found here: dotnet/sdk#5525
When I do "dotnet pack", it synthesizes a .nuspec. This nuspec has several problems:
I wish to provide my own .nuspec file for it to use instead.
Expected behavior
If I do "dotnet pack" and my working directory already contains a .nuspec file, then it should use that.
Or: if I do "dotnet pack -h" then it should provide information on how to provide my own nuspec file.
Actual behavior
It doesn't do either.
Environment data
dotnet --version
output: 1.0.0-beta-002133 on OSXThe text was updated successfully, but these errors were encountered: