Git Product home page Git Product logo

set-projectfilesclickonceversion's Introduction

Description

This PowerShell script can be used to update a project file's (.csproj or .vbproj file) ClickOnce version, and to set the Minimum Required Version to the lastest version.

This script is useful when publishing your ClickOnce application as part of your build and release system, since normally Visual Studio would automatically handle updating the ClickOnce version for you.

Setting the MinimumRequiredVersion property forces the ClickOnce application to update automatically without prompting the user. If you are simply looking to have the Minimum Required Version update automatically, but still publish your ClickOnce application from Visual Studio, try using the AutoUpdateProjectsMinimumRequiredClickOnceVersion NuGet Package.

Script Parameters

  • ProjectFilePath (required) - Path of the .csproj and .vbproj file to process.

  • Version - The Version to update the ClickOnce version number to. This version must be of the format Major.Minor.Build or Major.Minor.Build.Revision. The Build and Revision parts will be overridden by the BuildSystemsBuildId parameter, if it is provided. The Revision parts will be overriden by the IncrementProjectFilesRevision parameter, if it is provided.

  • BuildSystemsBuildId - The build system's unique and auto-incrementing Build ID. This will be used to generate the Build and Revision parts of the new Version number. This will override the Build and Revision specified in the Version parameter, if it was provided. This parameter cannot be used with the IncrementProjectFilesRevision parameter.

  • IncrementProjectFilesRevision - If this switch is provided, the Revision from the project file will be incremented and used in the new ClickOnce Version. This will override the Revision specified in the Version parameter, if it was provided. This parameter cannot be used with the BuildSystemsBuildId parameter.

  • UpdateMinimumRequiredVersionToCurrentVersion - If this switch is provided, the ClickOnce MinimumRequiredVersion will be updated to match the new Version. Setting the MinimumRequiredVersion property forces the ClickOnce application to update automatically without prompting the user.

  • PublishUrl - If this switch is provided, the ClickOnce PublishUrl will be updated. The publish url format is \\fileshare\foldername

  • InstallUrl - If this switch is provided, the ClickOnce InstallUrl will be updated. The install url format is http://fileshare/foldername

Examples

Update a project file's ClickOnce version to the specified version.

& .\Set-ProjectFilesClickOnceVersion.ps1 -ProjectFilePath "C:\SomeProject.csproj" -Version '1.2.3.4'

Update the Build and Revision parts of a project file's ClickOnce version, based on a unique, auto-incrementing integer, such as a build system's Build ID.

& .\Set-ProjectFilesClickOnceVersion.ps1 -ProjectFilePath "C:\SomeProject.csproj" -BuildSystemsBuildId 123456

Increment the Revision of a project file's ClickOnce version.

& .\Set-ProjectFilesClickOnceVersion.ps1 -ProjectFilePath "C:\SomeProject.csproj" -IncrementProjectFilesRevision

Update a project file's ClickOnce Minimum Required Version to match its current version.

& .\Set-ProjectFilesClickOnceVersion.ps1 -ProjectFilePath "C:\SomeProject.csproj" -UpdateMinimumRequiredVersionToCurrentVersion

Update a project file's ClickOnce version, ignoring the Revision part and incrementing the Revision stored in the file, and update the Minimum Required Version to be this new version.

& .\Set-ProjectFilesClickOnceVersion.ps1 -ProjectFilePath "C:\SomeProject.csproj" -Version '1.2.3' -IncrementProjectFilesRevision -UpdateMinimumRequiredVersionToCurrentVersion

Update a project file's ClickOnce version and its install and publish url values.

& .\Set-ProjectFilesClickOnceVersion.ps1 -ProjectFilePath "C:\SomeProject.csproj" -Version 1.0.1.9 -PublishUrl "\\fileshare\foldername" -InstallUrl "http://fileshare/foldername"

set-projectfilesclickonceversion's People

Contributors

begroff avatar deadlydog avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

set-projectfilesclickonceversion's Issues

Feature Request

Have you ever thought of updating this to change additional nodes in the property group for ClickOnce like PublishURL and InstallURL?

I have a need for it at my company as we deploy ClickOnce apps in different locations in Dev and Test/Prod and I want to add this script to their associated builds. I made some changes where I add those two parameters and set/update them before the logic of getting setting app version.

I forked the repository and was going to submit a pull request after adding some more tests.

Thoughts?

Output prints 'Updating version number to be 'x.x.x.x' even when not updating the version number

Thanks for this, I just thought it was worth mentioning my confusion when I ran this line below...
That the output says it's updated the version number when the command does not ask for it.

I'm either confused in my state of debugging or suggesting that the version number shouldn't be updated unless the relevant updates are asked for (-IncrementProjectFilesRevision and -UpdateMinimumRequiredVersionToCurrentVersion )

This is useful for me, as I'm doing 32 and 64 bit releases, so on the command line it's critical that I only update the version once, so my 64-bit script needs to still update the URLs but not the version.

& .\Set-ProjectFilesClickOnceVersion.ps1 -ProjectFilePath '%MyProject%' -InstallUrl '%InstallUrl%' -PublishUrl '%PublishUrl%'"

That the output mentioned 3 updates instead of 2
Updating PublishUrl to be ...
Updating Install Url to be ...
Updating version number to be 'x.x.x.21' <- didn't expect this when didn't ask for it, but I may be confused

dependentAssembly and assemblyIdentity not updated

Hi @deadlydog

I've followed your blog post to create a new CI/CD pipeline for a simple dummy WPF application. I have the build working (with an updated version number) and this is deploying back a shared drive on my laptop (via DevOps deployment groups).

In the published folder I can see a versioned folder sitting in Applications Files, for example;
Publish\Application Files\DeploymentTesting.WpfApp_1_0_0_13

I can install the application from Publish\setup.exe and it is working correctly.

When I commit an update I can see both CI and CD pipes get completed and a new version of the application is been deployed to my local publish folder, for example;
Publish\Application Files\DeploymentTesting.WpfApp_1_0_0_14.

When I restart the installed application the check is running and then the old version (1.0.0.13) is starting.

Inside the Publish\DeploymentTesting.WpfApp.application file the dependentAssembly and assemblyIdentity nodes are still referencing the original versioned folder:
<dependency> <dependentAssembly dependencyType="install" codebase="Application Files\DeploymentTesting.WpfApp_1_0_0_13\DeploymentTesting.WpfApp.exe.manifest" size="8852"> <assemblyIdentity name="DeploymentTesting.WpfApp.exe" version="1.0.0.13" publicKeyToken="d5e816d8c223a95a" language="neutral" processorArchitecture="msil" type="win32" />

My understanding it that this should be updated and created automatically via the build step with /target:Publish.

I'd really appreciate your thoughts on this. Do you have any ideas where I might have gone wrong?

Thanks,
Mark

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.