Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- Inputs: $(OutputPathBuild) - location of the build results
- $(OutputPathDeployment) - where the resulting ClickOnce files are to be stored
- $(Version) - application version to be used (you should **REALLY** make this the same
- as assembly version, but that's far from trivial and outside the scope
- of this example).
- $(Mage) - full path to the mage tool
- Assumes a certain directory structure that need not be the case
- Sets both min & max version, making all updates required
- Requires full trust.
- Application icon is expected at "Resources\Icon.ico"; a signing key at "Keys\MyApp.pfx"
- Application can be started offline
- Links are installed in the Start Menu, but no desktop shortcut is generated.
- This particular example is for x86 CPU rather than AnyCPU.
- Summary: you still have to know how to use MAGE, and have a farily good idea of what
- you want from ClickOnce. You will have to tweak a bunch of these parameters. But at
- least you have a known working example to start with. You will have to generate a pfx
- key one way or another - again, outside the scope of this example (and could certainly
- have been made less of a PITA to generate by MS.
- -->
- <Target Name="Deployment">
- <Error Condition="'$(Version)'==''" Text="The Version property must be defined in order to build the Deployment task."/>
- <ItemGroup>
- <DeploySource Include="$(OutputPathBuild)\**"/>
- </ItemGroup>
- <Copy SourceFiles="@(DeploySource)" DestinationFolder="$(OutputPathDeployment)\v$(Version)\%(RecursiveDir)"/>
- <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'/>
- <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'/>
- <!-- Grr... Mage tool has a bug whereby -MinVersion only works in Update mode... -->
- <Exec Command='"$(Mage)" -Update "$(OutputPathDeployment)\MyApp.application" -MinVersion $(Version) -CertFile Keys\MyApp.pfx'/>
- <Copy SourceFiles="$(OutputPathDeployment)\MyApp.application" DestinationFiles="$(OutputPathDeployment)\MyApp.v$(Version).application"/>
- </Target>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement