Scripting Visual Studio build, Clickonce deployment, Dotfuscator and Mage
-
03-07-2019 - |
Question
The process for releasing my application to the client is per the heading
- Build
- Clickonce deployment
- Obfuscating the main executable with Dotfuscator
- Signing the manifest and .application files with mage
- Zip for delivery
I'd like to work on an opensource program to automate this as it uses a lot of time everytime a release is needed for the client. I think asking for a solution is a bit much ;) so what would be the ideal format? Batch script, C# application?
Is anyone aware of an existing solution for this process or willing to collaborate on one?
Solution
So I guess you are not looking into using MSBuild?
Because that also comes free with the .net SDK. Your Visual Studio projects are already MSBuild project files, so you can use these and modify them to make a complete integrated build.
To generate your ClickOnce deployment, you would then use the following MSBuild tasks:
- GenerateApplicationManifest
- GenerateDeploymentManifest
- Exec
- SignFile
Because of some issues I also need to run mage after these, eg to update the manifest and sign it, I use the Exec Task for this:
<!-- Correct the codebase property pointing to the application manifest file -->
<Exec
Command=""$(SdkPath)bin\mage" -Update "$(DeploymentManifest)" -AppManifest "$(ApplicationManifest)""
WorkingDirectory="$(PublishDir)" />
<!-- Signing the Deployment manifest -->
<Exec
Command=""$(SdkPath)bin\mage" -Sign "$(DeploymentManifest)" -CertFile "$(SolutionRoot)\$(Branch)\Source\esamba.pfx" -Password esamba"
WorkingDirectory="$(PublishDir)" />
I hope this helps you.
OTHER TIPS
Why not use a build tool like nant which is extensible with custom tasks as needed.
Since this is a common problem there are likely predefined tasks for most tasks you have, and you can easily call other executables, or write custom code in any .NET language to add tasks.