-
Notifications
You must be signed in to change notification settings - Fork 224
[Question] Externally providing version for dnu pack? #2190
Comments
Today we do this but only with the prerelease suffix. You can make a {
"version": "1.0.0-*"
} If you set the |
Thanks for the quick answer. Any plans to make this work with the version itself and not just the prerelease? My current situation is that I can bump patch, minor and even major versions simply by performing git operations (and not modifying a single nuspec or AssemblyInfo.cs). I think it's important not to lose this capability in DNX... |
There are not plans currently to make this work. Is this a CI scenario or mostly just how things are controlled in general? The scenario makes sense and I'm not opposed to bring back the version replacement token. I do have some questions about how that works with project references:
|
Well, it's how things are controlled in general, although the logic is important mainly for the CI (versions don't matter much for local developer builds, at least in my setup). Normally when you go with an automated GitFlow-based versioning scheme (à la GitVersion) yes, you're constrained to the entire solution being versioned with the same version; this is a simple consequence of the version being derived from your git branch (develop, master). Of course other scenarios exist out there for deriving versions; some people store the version in some arbitrary text file and read that as part of the build. This allows you to manage different versions for individual projects within the same solution. IMHO the important thing is to make any versioning scheme possible by allowing a full environment variable plus replacement token. I'd be happy to provide any other details you're interested in. |
I know you're asking for a feature that exists in NuGet but I still want to understand the scenario better because in practice things are usually only used in a few ways. That's not an excuse for removing features, it's a way to figure out what a better workflow would be in the common case. For example, we're looking at a feature to enable specifying the version in The reason we only supported replacement for the pretag is exactly what you said, usually on the CI is where you bump versions. Our local build scripts actually use it the same way, when you build, we generate a timespant That said it's pretty important to be able to pass any initial version as input to the build. We'd want to allow that for |
The My basic need in life is to be able to never touch (and commit) any file as part of a version bump operation, any scheme allowing that would probably be OK. I imagine that the easiest way to support this is probably via an environment variable that gets set by a tool such as GitVersion... |
Sounds good, care to do a pull request? The relevant code is here https://github.com/aspnet/dnx/blob/dev/src/Microsoft.Framework.Runtime/Project.cs#L186 |
Sure, I'll be happy to contribute on this, but here are some design questions:
|
Any ideas on the questions above? |
@davidfowl @roji Any news about this request? |
Something that comes to my mind when considering this situation: I'm a fan of the global version for the solution - normally changes are done in the context of a solution, builds in CI are in the solution's context, etc. So versioning at the solution makes it easy to relate changes to the set of projects as a cohesive unit. Cognitive load is reduced when managing the dependencies. Nonetheless, by changing at the solution level, we are breaking the version changes' meaning at specific projects. If a specific project has no changes, should the output assembly / package have a new version? If it is acceptable, and I can comprehend that a dev or team may accept this, then some packages simply will have version changes without having any internal change (possibly not even dependency changes). The benefit (and option) of having this may outweigh the loss of coherent semantics in the version number alterations. Also, as somewhat mentioned in @roji 's original post, the version number in the global.json should establish the minimum version number for package dependencies that is generated within the solution. This would be so that nuget version resolution can correctly update all the dependencies (especially all those generated in the same solution) when any package update is performed in other solutions. I've had multiple problems of this sort in projects (generate stuff from one solution, then update packages in another, but guaranteeing that all have consistent dependencies), and i believe should be taken into consideration. |
@davidfowl, @glennc or others, can we have a quick discussion on the design questions I asked above? After that I can work on a PR. |
Is there any chance this could get looked at @davidfowl or anyone who works on DNX? |
Sure @glennc can we setup a design meeting for this? |
If you guys need any more input on usage scenarios etc. let me know! |
Here are some input thoughts on what is needed and how to achieve it. Some common versioning scenarios (bumping refers to all version bumps, not just prerelease tags):
Here's a proposal for supporting the above requirements, ordered by descending priority:
dnu currently supports a half-half model, where the base version is manually-defined in the project.json, and the prerelease is passed externally through the DNX_BUILD_VERSION environment variable. This can be maintained via a DNX_PRERELEASE_VERSION environment variable (and possibly command-line switch), although it may be sufficient to simply allow the entire version to be externally-determined as proposed above (discarding the half-half mode). Note that there should also ideally be a way to refer to the global.json version when specifying versions of dependencies. This is important for creating same-version dependencies between projects of the same solution (as mentioned above). |
Should the variable be named |
@pranavkm good point. |
|
Bump! I have a similar issue now. |
👍 I would most certainly enjoy this feature |
@glennc @davidfowl any progress on this? |
+1 for @roji's latest list of requirements. Would really like to build projects in a CI scenario and it's not currently as easy as it should be. |
Has anyone been able to get the
I'm still getting my |
@RehanSaeed, don't forget the version in your project.json must contain "1.0.0-*" for the |
@roji I've done that, it's the default anyway:
|
This issue was moved to dotnet/cli#571 |
👍 |
Apologies if this has been answered/discussed.
I am looking for a way to create nuget packages of my project with
dnu pack
, but with an externally-provided version (instead of the one specified in the project.json). The use-case is a tool like GitVersion, which automatically determines the version from gitflow; it is executed at the build server, setting some variables for versions which should later be used when creating the nuget package. When creating nugets in the old way (nuget pack
) the -Version switch does this work.On a very related note, we also need some way to access this version variable from within the project.json when specifying dependencies on other packages. The scenario is multiple nugets created from the same repository, with automatic dependencies between them on the exact version as derived from gitflow. In the old way the nuspec could simply contain
$version$
.The text was updated successfully, but these errors were encountered: