Advertisement
Guest User

Romkyns

a guest
Jan 28th, 2010
1,983
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 2.77 KB | None | 0 0
  1.   <!-- Inputs: $(OutputPathBuild) - location of the build results
  2.               $(OutputPathDeployment) - where the resulting ClickOnce files are to be stored
  3.               $(Version) - application version to be used (you should **REALLY** make this the same
  4.                            as assembly version, but that's far from trivial and outside the scope
  5.                            of this example).
  6.               $(Mage) - full path to the mage tool
  7.  
  8.               Assumes a certain directory structure that need not be the case
  9.               Sets both min & max version, making all updates required
  10.               Requires full trust.
  11.               Application icon is expected at "Resources\Icon.ico"; a signing key at "Keys\MyApp.pfx"
  12.               Application can be started offline
  13.               Links are installed in the Start Menu, but no desktop shortcut is generated.
  14.               This particular example is for x86 CPU rather than AnyCPU.
  15.  
  16.               Summary: you still have to know how to use MAGE, and have a farily good idea of what
  17.               you want from ClickOnce. You will have to tweak a bunch of these parameters. But at
  18.               least you have a known working example to start with. You will have to generate a pfx
  19.               key one way or another - again, outside the scope of this example (and could certainly
  20.               have been made less of a PITA to generate by MS.
  21.    -->
  22.  
  23.   <Target Name="Deployment">
  24.     <Error Condition="'$(Version)'==''" Text="The Version property must be defined in order to build the Deployment task."/>
  25.     <ItemGroup>
  26.       <DeploySource Include="$(OutputPathBuild)\**"/>
  27.     </ItemGroup>
  28.     <Copy SourceFiles="@(DeploySource)" DestinationFolder="$(OutputPathDeployment)\v$(Version)\%(RecursiveDir)"/>
  29.     <Exec Command='"$(Mage)" -New Application -ToFile "$(OutputPathDeployment)\v$(Version)\MyApp.manifest" -Name MyApp -Version $(Version) -Processor X86 -CertFile Keys\MyApp.pfx -FromDirectory "$(OutputPathDeployment)\v$(Version)" -TrustLevel FullTrust -IconFile Resources\Icon.ico'/>
  30.     <Exec Command='"$(Mage)" -New Deployment -ToFile "$(OutputPathDeployment)\MyApp.application" -Name MyApp -Version $(Version) -Processor X86 -AppManifest "$(OutputPathDeployment)\v$(Version)\MyApp.manifest" -CertFile Keys\MyApp.pfx -IncludeProviderURL true -ProviderURL "http://example.com/download/MyApp/MyApp.application" -Install true'/>
  31.     <!-- Grr... Mage tool has a bug whereby -MinVersion only works in Update mode... -->
  32.     <Exec Command='"$(Mage)" -Update "$(OutputPathDeployment)\MyApp.application" -MinVersion $(Version) -CertFile Keys\MyApp.pfx'/>
  33.     <Copy SourceFiles="$(OutputPathDeployment)\MyApp.application" DestinationFiles="$(OutputPathDeployment)\MyApp.v$(Version).application"/>
  34.   </Target>
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement