NAant ClickOnce deployment script and minimum required version?
-
Wednesday, October 20, 2010 9:28 AM
Hi!
I have an application (developet in VS2005 .NET Framework 2.0) for which I have created a deployment script using NAant. It works like a charm except for one thing, I need to force the user to update the application once a new version is avaliable. I just don't seem to be able to achive this?! Below you can see the script:
I have noticed when I examine the Application.application that the update tag looks like this:
<update> <expiration maximumAge="0" unit="days" /> </update>
instead of
<update> <beforeApplicationStartup /> </update>
which is the case if I generate the ClickOnce-deployment from VisualStudio.
Also the deployment tag looks different. The Application.application file contains this:
<deployment install="true">
While the VS2005 generated file contains this:
<deployment install="true" minimumRequiredVersion="x.x.x.x" />
What do I need to change to make it work? (I have used the mage.exe supplied with VS2008, mage.exe for VS2005 somehow didn't work)
Thanks in advance!
<?xml version="1.0"?> <project name="Application" default="publish"> <!-- Set .NET Framework 2.0 to match the version of Application. --> <echo message="Setting current .NET Framework to version .NET 2.0." /> <property name="nant.settings.currentframework" value="net-2.0" /> <target name="publish"> <!-- Setting variables containing all directories necessary. --> <!-- TODO: SET ACTUAL BUILD DIRECTORY --> <property name="build.dir" value="C:\DATA\Dev\Application\Application\bin\Debug" /> <property name="build.file" value="${build.dir}\Application.exe" /> <!-- TODO: SET ACTUAL DEPLOYMENT DIRECTORY --> <property name="Deployment.dir" value="C:\DATA\Dev\ClickOnceDeployment" /> <property name="publish.version" value="${script::get-file-version(build.file)}" /> <!-- TODO: SET ACTUAL PUBLISH URL! --> <property name="publish.url" value="C:\DATA\Dev\Click\publish" /> <echo message="Publishing version ${publish.version} of Application" /> <!-- Copy all the files to the deploy folder --> <echo message="Copying Application files from ${build.dir} to $${Deployment.dir}\${publish.version}." /> <delete dir="${Deployment.dir}\${publish.version}" failonerror="false" /> <mkdir dir="${Deployment.dir}\${publish.version}" /> <copy todir="${Deployment.dir}\${publish.version}" overwrite="true" includeemptydirs="true" > <fileset basedir="${build.dir}"> <includes name="**" /> </fileset> </copy> <!-- Creating Application Manifest --> <echo message="Creating application manifest ${Deployment.dir}\${publish.version}\Application.exe.manifest." /> <exec program="mage" commandline="-New Application -t ${Deployment.dir}\${publish.version}\Application.exe.manifest -fd ${build.dir} -Name Application -Version ${publish.version}" /> <exec program="mage" commandline="-Sign ${Deployment.dir}\${publish.version}\Application.exe.manifest -CertFile Application.pfx -Password application_password" /> <!-- Creating Deployment Manifest --> <echo message="Creating deployment manifest ${Deployment.dir}\${publish.version}\Application.exe.manifest." /> <exec program="mage" commandline='-New Deployment -t ${Deployment.dir}\Application.application -pu ${publish.url}\Application.application -Name Application -install true -appm ${Deployment.dir}\${publish.version}\Application.exe.manifest -Version ${publish.version}' /> <exec program="mage" commandline="-Update ${Deployment.dir}\Application.application -MinVersion ${publish.version} -UseManifestForTrust true -Publisher MyCompany" /> <exec program="mage" commandline="-Sign ${Deployment.dir}\Application.application -CertFile Application.pfx -Password application_password" /> </target> <!-- *****************************************************************************************--> <!-- Script extracting the file version of a file which path and name is an in parameter to --> <!-- this function. --> <!-- *****************************************************************************************--> <script language="C#" prefix="script"> <imports> <import namespace="System.Diagnostics" /> </imports> <references> <include name="c:\windows\microsoft.net\framework\v2.0.50727\system.dll" /> </references> <code> <![CDATA[ [Function("get-file-version")] public string GetFileVersion( string file ) { System.Diagnostics.FileVersionInfo myFileVersionInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(file); return myFileVersionInfo.FileVersion; } ]]> </code> </script> </project>
- Moved by Victor_Chen Thursday, October 21, 2010 9:32 AM clickonce and deployment (From:MSBuild)
All Replies
-
Thursday, October 21, 2010 9:31 AM
Hi Sekarmaeu,
Thanks for your post.
I think this issue is more relevant to Clickonce and deployment. I'm going to move it.
Hope you can get more helpful information there.
Ziwei Chen
-
Sunday, October 24, 2010 6:17 AMModerator
This isn't something that can be changed using Mage. I am not familiar with NAant, but it's probably a wrapper around the mage tool provided by Microsoft.
RobinDotNet
Click here to visit my ClickOnce blog!
Microsoft MVP, Client App Dev


