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

Support for new csproj version properties #25

Open
sparerd opened this issue Feb 22, 2019 · 7 comments
Open

Support for new csproj version properties #25

sparerd opened this issue Feb 22, 2019 · 7 comments

Comments

@sparerd
Copy link

sparerd commented Feb 22, 2019

Add support for managing version numbers within the new style of csproj. While it is possible to continue using the AssemblyInfo.cs file for managing version data with the newer project format, it does require setting <GenerateAssemblyInfo>false</GenerateAssemblyInfo> which has implications for other project properties.

Sample project file:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <Version>1.0.0.0</Version>
    <AssemblyFileVersion>1.0.0.0</AssemblyFileVersion>
    <AssemblyVersion>1.0.0.0</AssemblyVersion>
  </PropertyGroup>
</Project>

Specs

  1. The Version property is the default property for managing version information. By default, all other version properties take their values from this property.
    1. If no version properties are found in the file, add a Version property with the new version number. Versions begin at 1.0.0.0 for new projects.
    2. If a Version property exists in the file, update it with the new version number (regardless of the existence of other version properties).
    3. If no Version property is found, but only one AssemblyVersion or AssemblyFileVersion are found (exclusive-or), add a Version property with the new version number taken from the preexisting version field (AssemblyVersion or AssemblyFileVersion).
    4. If no Version property is found, but both AssemblyVersion and AssemblyFileVersion are found, do not add a Version property.
    5. The Version property can contain extended version data beyond the patch number (ex. 1.2.3.4-beta1). The extended version data will be treated as a version part with lower rank than the patch part and will be removed as part of any version update operation.
  2. AssemblyFileVersion
    1. If a AssemblyFileVersion property is ever found, update it with the new version number.
    2. If a AssemblyFileVersion property is not found, do not add it.
  3. AssemblyVersion
    1. If a AssemblyVersion property is ever found, update it with the new version number.
    2. If a AssemblyVersion property is not found, do not add it.

If this looks good to you, I would be willing to put in a PR. I haven't worked with F# before (I'm a C# dev), but it would be fun to give it a go.

@ploeh
Copy link
Owner

ploeh commented Feb 28, 2019

Sorry about the slow response. I'm currently at a conference, which demands my attention.

I think it sounds like a good idea to support the new file format 👍

I have to admit that I've done little professional .NET work for the last couple of years, so I haven't kept up to date with developments. This means that essentially, I currently don't have the knowledge to evaluate whether or not the above specification is appropriate.

The most important quality of any change in that direction is that the old functionality still works, without any breaking changes.

You're welcome to send a pull request, but I'll probably solicit help from other people to review it, since this currently exceeds my expertise.

@moodmosaic
Copy link
Contributor

My situation is more or less similar to @ploeh, but it happened to do some work in the past year converting .csproj (and .fsproj) to the new file format, so I may be able to help by taking a look on related pull requests.

@ploeh
Copy link
Owner

ploeh commented Feb 28, 2019

@sparerd, FTR, I've worked with @moodmosaic for many years, and trust his judgement. If he's willing to help me out with a review, we should be able to work together to produce something useful 😄

@sparerd
Copy link
Author

sparerd commented Feb 28, 2019

@ploeh @moodmosaic Sounds great to me, I'll get cracking. First step is to learn some F# 😉

The most important quality of any change in that direction is that the old functionality still works, without any breaking changes.

Agreed. My company is still largely on the old AssemblyInfo.cs style. Any implementation will be focused on supporting a mixed-csproj environment without any breaking changes.

Enjoy your conference!

@sparerd
Copy link
Author

sparerd commented Feb 28, 2019

I have the very basic cases working. I'll need to work through the corner cases over the next week. Do you prefer PRs when all work is complete or while still in-progress (pair-programming-over-the-internet style)?

@ploeh
Copy link
Owner

ploeh commented Mar 1, 2019

I prefer small, complete pull requests, please 😄

@sparerd
Copy link
Author

sparerd commented Mar 1, 2019

Sounds good. I'll submit when ready for final review.

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

3 participants