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

Update version in project.json files #980

Closed
wants to merge 8 commits into from

Conversation

droyad
Copy link

@droyad droyad commented Jul 28, 2016

Added the /updateprojectjson switch to GitVersion.exe which replaces the version in Project.json files. Closes #647.

@dazinator
Copy link
Member

This capability would be really nice to have. I would love to see this in GitVersion because project.json's are currently a fact of life, even though they are expected to go away at some point in the future.. What are thoughts opinions around this?

@gep13
Copy link
Member

gep13 commented Aug 8, 2016

@dazinator I have started using this: https://github.com/sergeyzwezdin/magic-chunks/ As it integrates really nicely with Cake, which I am now using for all my builds.

Here is an example of updating a project.json file with it:

https://github.com/OctopusDeploy/CSProjToXProj/blob/master/build.cake#L110

@dazinator
Copy link
Member

dazinator commented Aug 8, 2016

@gep13 - thanks for that, I haven't looked at Cake in much depth yet, but I like the fact you can use c# syntax! Unfortunately switching to a Cake build isn't an option for us at present, so I am looking for alternatives like this PR..

@droyad I have noticed a bit of a problem with this PR in that it can break the build as it doesn't deal with updating version numbers in project references. For example, if you have ProjectA.json which references ProjectB.json, then ProjectA.json will have this dependency entry:

{
"dependencies": {
 "ProjectB": "1.0.0-*"
}

This functionality updates the version's of both projects, for example to 1.1.0-alpha1 and now the solution won't build because the dependencies section is now invalid. So for using this to build a multi-project solution, I think this would need to be solved..

Also I stood up a chocolatey package for this PR to make things a bit easier (hope you don;t mind) https://chocolatey.org/packages/GitVersion.Portable.ReachFork/4.0.0-ReachBeta1

@gep13
Copy link
Member

gep13 commented Aug 8, 2016

@dazinator what are you currently using to run GitVersion?

@droyad
Copy link
Author

droyad commented Aug 8, 2016

@dazinator I use just the wildcard to reference other projects, ie:

{
"dependencies": {
 "ProjectB": "*"
}

Are there any drawbacks to that approach?

@dazinator
Copy link
Member

@gep13 - a team city command line step!

@droyad - ah yeah so I tried that myself before I posted but it didn't work.. i'll try again - if it works for you then i probably just need to clear the project.lock files or something.

@gep13
Copy link
Member

gep13 commented Aug 9, 2016

@dazinator said,,,
@gep13 - a team city command line step!

Gotcha. I was going to say that if you were using any other type of build script, i.e. psake, or something like that, then Magic Chunks has some plugins for there too. It isn't just limited to Cake usage.

@JakeGinnivan
Copy link
Contributor

Fyi to reference other projects you can do:

{
"dependencies": {
 "ProjectB": { "target": "project" },
}

@JakeGinnivan
Copy link
Contributor

Thoughts on https://github.com/ah-/dotnet-gitversion

We could move this into a new project as done in that repo?

@gep13
Copy link
Member

gep13 commented Aug 14, 2016

Makes sense to me.

@asbjornu
Copy link
Member

@JakeGinnivan: That looks like a great effort from @ah-. Can't we just move his repository into the GitTools organization and make it official?

@JakeGinnivan
Copy link
Contributor

I think his repo is a port to dotnet core. I am happy for someone else to take the lead on this feature :)

@JakeGinnivan
Copy link
Contributor

If you need something specific from me let me know

@clairernovotny
Copy link

I'm not sure this is needed anymore. Instead, cross-compile the existing GitVersionTask for net4 and NetCoreApp. Then it can be used directly by csproj everywhere as I describe in #1118

@droyad
Copy link
Author

droyad commented Dec 14, 2016

Agreed. With the move back to msbuild system, the classic ;) approach can be used.

@asbjornu
Copy link
Member

Can this be closed, then?

@dazinator
Copy link
Member

dazinator commented Dec 14, 2016

Does that require an upgrade from VS2015 to VS2017 in order to migrate from project.json back to msbuild? Just concerned that project.json files might remain for those stuck on vs2015 if so? (sadly, that includes me)

@clairernovotny
Copy link

project.json will only work with vs 2015 and the new tooling will only work with vs 2017. The tooling are preview tooling with vs 2015 and will not get any more updates. Moving to VS 2017 is really the only option.

@dazinator
Copy link
Member

dazinator commented Dec 14, 2016

hmm ok.. I'm going to enjoy explaining that cost to my manager haha. How about the cross plat story, for example Linux.. will there be new tooling on Linux to replace project.json as well?

@clairernovotny
Copy link

All of the tooling is going to be csproj only, including cross platform. The current preview4 CLI tooling already supports the csproj.

@dazinator
Copy link
Member

Ok cool, thanks for explaining @onovotny - project.json shall be consigned to the dustbin of history, and anyone stuck on it will have a migration path... sounds very sensible to close this issue :-)

@dazinator
Copy link
Member

@gep13 - I ended up moving from team city to appveyor and cake in the end and using Magic Chunks. I don't regret it. Team City is now dead to me.

@asbjornu asbjornu closed this Dec 15, 2016
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

Successfully merging this pull request may close these issues.

6 participants