MobileEssentials / MSBuilder

Reusable MSBuild Building Blocks
MIT License
41 stars 13 forks source link

Add VSIX manifest identity version #20

Closed Plac3hold3r closed 6 years ago

Plac3hold3r commented 6 years ago
kzu commented 6 years ago

Thanks a lot for your contribution @Plac3hold3r!

I should point out that for VSIX version, a most common case is to actually use MSBuild expansions there, like Version="|MyProject.Vsix;GetVsixVersion|". Have you checked that this will still render the right value in that case too?

Thanks again

Plac3hold3r commented 6 years ago

Ah, I see what you are saying. Projects like Microsoft nodejstools and Microsoft xamarin-android all use a variation of the pattern you describe were MSBuild is used to add the version number. I was not aware of this pattern, which is pretty cool.

I tested it out and you are correct it does not render the correct version number but rather the string. A side note, a copy of the correct manifest with the correct version number is generated and placed in the output directory. But I'm not sure if there is support currently for changing to look at that version of the outputted file or the viability of doing so?

For reference, this was the project with the use case. I'm using the version number in the manifest with a modified version of MSBuilder to include the version programmatically to make it accessible within the VSIX wizard. This has been working fine for my current use case, but I see your point that it is probably not well suited for current practices in terms of how version numbering is defined within MSBuild.

kzu commented 6 years ago

Here are some ideas: https://github.com/xamarin/Xamarin.VSSDK/blob/master/src/VSSDK.BuildTools/Xamarin.VSSDK.BuildTools.VsixManifest.targets

In particular, maybe just running after DetokenizeVsixManifestFile VSSDK target and reading the values from $(IntermediateVsixManifest) would be enough?

Plac3hold3r commented 6 years ago

I have updated the PR to now use the IntermediateVsixManifest as suggested. I was only able to test with Visual Studio 2017 15.6.6., which worked without issue in parsing the version number correctly from the version defined in my csproj and |%CurrentProject%;GetVsixVersion| in my VSIX manifest.

kzu commented 6 years ago

Great, thanks for your contribution!