Skip to content
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 build --version-prefix 1.0.0 #7664

Closed
niemyjski opened this issue Feb 2, 2017 · 12 comments
Closed

dotnet build --version-prefix 1.0.0 #7664

niemyjski opened this issue Feb 2, 2017 · 12 comments
Milestone

Comments

@niemyjski
Copy link

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 #4608

@livarcocc
Copy link
Contributor

cc @blackdwarf

@LeeCampbell
Copy link
Contributor

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

@TheRealPiotrP
Copy link
Contributor

@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.

@LeeCampbell
Copy link
Contributor

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-betaABC\project.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?

#cantKeepUp

@blackdwarf
Copy link

@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.

@LeeCampbell
Copy link
Contributor

Thanks for the quick repsonse @piotrpMSFT and @blackdwarf

@TheRealPiotrP
Copy link
Contributor

No problem @LeeCampbell. Let us know if we can help with anything else.

@rui-ktei
Copy link

rui-ktei commented Mar 21, 2017

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.

@livarcocc
Copy link
Contributor

livarcocc commented Mar 21, 2017

You can use /p:Version=<your_version> as an argument.

@rui-ktei
Copy link

@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:

image

@livarcocc
Copy link
Contributor

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.

@rui-ktei
Copy link

@livarcocc sorry about that... i just noticed I was using old SDK. My bad. It works now. Thank you very much for the help!

@msftgits msftgits transferred this issue from dotnet/cli Jan 31, 2020
@msftgits msftgits added this to the 2.0.0 milestone Jan 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants