How come I can do --version-suffix but not prefix? I know I can do a build property but I shouldn't have to... See dotnet/sdk#4608
cc @blackdwarf
Personally, I am not sure why there needs to be a separation of prefix and suffix. Cant there just be a version
? e.g. dotnet pack -version 1.2.3-betaABC
@LeeCampbell you can certainly dotnet pack /p:Version=1.2.3-betaABC
.
The version suffix
concept was introduced in project.json
CLI. It enables the workflow of specifying the Major.Minor.Patch and keeping it fixed in the project files while allowing the version suffix to vary build-by-build.
You're right, though, that now that we're in MSBuild we have a much more powerful property engine in place and there are new ways to express version number policies. This option will make it easier for folks who are migrating from a project.json workflow, but I'm curious to see how folks choose to manage versioning in their solutions now that the project system is so much more flexible.
Thanks for the update.
What would I need to do to get that working locally? I have what I believe to the be latest SDK dotnet-dev-win-x64.1.0.0-preview2-1-003177.exe
installed, and it get "Unrecognized command or argument '/p:Version=1.0.0'"
Running exactly what you have suggested dotnet pack /p:Version=1.2.3-betaABC
in a directory that has the project.json file errors with "Unable to find a project.json in /p:Version=1.2.3-betaABCproject.json". Or is that the point? The work I have just done to migrate to project.json is wasted, and the tooling is back to csproj? Or does this command only work from nightly builds?
@LeeCampbell sorry for the confusion. The syntax @piotrpMSFT was showing is for MSBuild-based tools. We have been busy working on them for the past several months, and they are due to be released together with Visual Studio 2017.
You can try the MSBuild-based tools by installing RC4 bits (https://github.com/dotnet/core/blob/master/release-notes/rc4-download.md has the information). However, do note that these tools are based on csproj
projects so they don't support working with project.json
projects; that means you will have to migrate or start a new project to try them out. If you want to switch between the two versions, see https://github.com/dotnet/cli/blob/rel/1.0.0/Documentation/ProjectJsonToCSProj.md.
Thanks for the quick repsonse @piotrpMSFT and @blackdwarf
No problem @LeeCampbell. Let us know if we can help with anything else.
Jesus, I searched a lot on google and it let me here and after I read the comments above... ah...
is there any SIMPLE way to actually just create a nuget package by doing dotnet pack --version xxx
???
I'm using latest dotnet core and apparently you guys dumped project.json, which is okay... now problem is: dotnet pack
doesn't support --version
, or maybe I missed something. Okay, bottom line, is there any way to just run a simple dotnet
command to create a nuget package with specified version?
I don't want to use version-suffix as I'm not running a pre-release build, I just want my TeamCity build to work. I want to bump up the patch version every time I run the build, however, I can't do it currently coz dotnet pack
seems not to support --version parameter at all. Also, I have no interest to install the MSBuild thank you.
Why do you guys always try to make simple things HARDER??
Update: I was using old SDK. In latest SDK, dotnet pack /p:Version works fine. Ignore my rant.
You can use /p:Version=
@livarcocc thank you for your help but I actually tried it. I don't think it works with latest dotnet core, as MS is dumping project.json. I got this:
Are you trying this with project.json? If so, then what I suggested to you above won't work at all. We are no longer making fixes for project.json (we haven't in a while actually) and I would suggest that you look into migrating to the lastest CLI (1.0.1) which you can get at dot.net and migration your project from project.json to csproj.
@livarcocc sorry about that... i just noticed I was using old SDK. My bad. It works now. Thank you very much for the help!
Most helpful comment
Personally, I am not sure why there needs to be a separation of prefix and suffix. Cant there just be a
version
? e.g.dotnet pack -version 1.2.3-betaABC