-
Notifications
You must be signed in to change notification settings - Fork 654
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
When support the deployment version of Clickonce? #1153
Comments
@maikebing what sort of support are you looking for? |
The release of the ClickOnce version number |
@gep13 ClickOnce doesn't care about the information provided in <ApplicationRevision>116</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion> or <ApplicationVersion>1.0.0.116</ApplicationVersion>
So if I would like to use GitVersion with ClickOnce I'd have to write a script which either throws the output of GitVersion into a I might look into this on the weekend to give a better picture Edit: I am not sure if ClickOnce would allow non-numerical data or if a three number format (A.B.C) can be used instead of the A.B.C.D format from above |
@gep13 I've looked more into this. As far as I can tell my assumption was right: ClickOnce only supports numerical version strings in the form A.B.C.D. This means that the properties Solution Draft 1 Here is a small snippet which injects the version information into a public static void WriteClickOnceVersionABCD(string csproj, string version)
{
var doc = new XmlDocument();
doc.Load(csproj);
var versionNodes = doc.GetElementsByTagName("ApplicationVersion");
foreach (XmlNode node in versionNodes)
{
node.InnerText = version;
}
var revisionNodes = doc.GetElementsByTagName("ApplicationRevision");
for (int i = revisionNodes.Count - 1; i >= 0; i--)
{
revisionNodes[i].ParentNode.RemoveChild(revisionNodes[i]);
}
doc.Save(csproj);
} This code will:
Solution Draft 2 Another approach could look like this: public static void WriteClickOnceVersionABC(string csproj, string version)
{
var doc = new XmlDocument();
doc.Load(csproj);
var revisionNodes = doc.GetElementsByTagName("ApplicationRevision");
for (int i = revisionNodes.Count - 1; i >= 0; i--)
{
revisionNodes[i].ParentNode.RemoveChild(revisionNodes[i]);
}
var versionNodes = doc.GetElementsByTagName("ApplicationVersion");
foreach (XmlNode node in versionNodes)
{
node.InnerText = $"{version}.%2a";
var revisionNode = doc.CreateElement("ApplicationRevision", node.NamespaceURI);
revisionNode.InnerText = "0";
node.ParentNode.InsertAfter(revisionNode, node);
}
doc.Save(csproj);
}
The benefit of this approach is that it is a little bit more flexible. The Is this something you would like to include in GitVersion, or is this requirement in general "too specific"? Edit: Added both code snippets |
@fwinkelbauer @maikebing <Target Name="MyApp_SetClickOnceVersion" AfterTargets="UpdateAssemblyInfo" DependsOnTargets="GetVersion" BeforeTargets="_DeploymentComputeClickOnceManifestInfo">
<CreateProperty Value="$(GitVersion_AssemblySemVer)">
<Output TaskParameter="Value" PropertyName="ApplicationVersion" />
</CreateProperty>
<!-- for VSTO -->
<CreateProperty Value="$(ApplicationVersion)">
<Output TaskParameter="Value" PropertyName="PublishVersion" />
</CreateProperty>
<Message Text="ApplicationVersion: $(ApplicationVersion)" Importance="High" />
</Target> This will set the properties |
@thoemmi yeah I agree, this is another simple solution that works. I was providing all this input so that we could consider if it is a good idea to integrate ClickOnce support into GitVersion. This way we wouldn't need to touch the By the way what does the |
I've implemented it already a couple of month ago. If I remember correcty, |
Agree with the general consensus that it's easy to workaround not putting support in. If we did the solution wouldn't work for those using mage anyways, so it wouldn't even be a complete solution. I have written up a more complete response at #1152, but the tl;dr is that I do not want us to put built in updating anything into GitVersion. Instead we should spin up a collection of smaller utilities which take the output of GitVersion and do the updates. This reduces the complexity and scope of GitVersion which is a good thing. |
If anyone would like to take these workarounds and add them into the docs, that would be great though :) pull requests welcome |
Is already supported but i will not use it? Still do not support?
The text was updated successfully, but these errors were encountered: