Using application signing with ClickOnce deployment

If you’re planning on doing a ClickOnce deployment of your product, here are few simple instructions to include DicomObjects licence (*.lic) file within your deployment package:

1. Create a dummy “applicationname.exe.lic” placeholder and include in your solution.
2. Change the Build Action property of your \*.lic in VS to Content type.
3. Change Copy to output directory setting to Copy if newer.
4 Set your post build event as:
* 4.1 \ApplicationSignerConsole.exe” “$(TargetPath)” [your key] [info1] [info2]
* 4.2 “copy “$(TargetPath).lic” “$(ProjectDir)$(TargetFileName).lic”

The first command is to generate a websigned *.lic file for your specific application with a special web-signing key starting  SK-xxxx-xxxx-xxxx.
The second command is to copy the above generated *.lic file to the placeholder within your solution that is included in your deployment manifest file.

<!-- Sign the application executable located in app.publish folder -->
<SignFile CertificateThumbprint="$(_DeploymentResolvedManifestCertificateThumbprint)" 
	TimestampUrl="$(ManifestTimestampUrl)" 
	SigningTarget="$(ProjectDir)$(IntermediateOutputPath)$(TargetFileName)" 
	Condition="'$(_DeploymentResolvedManifestCertificateThumbprint)'!='' 
		and '$(_DeploymentSignClickOnceManifests)'=='true' 
		and '$(TargetExt)' == '.exe'" TargetFrameworkVersion="v4.0" />
 
<!--  Run DicomObjects licence file generator after the EXE was signed (above) -->
<Exec Command="ApplicationSignerConsole.exe" 
	"$(ProjectDir)$(IntermediateOutputPath)$(TargetFileName)" $(LicenseString) $(Info1) $(Info2)" />

Keep in mind that the *.lic file gets generated every time you build it as it is in your post build event.

If there are no build errors, this should include the newly generated *.lic file in your deployment package.


We use cookies to give you the best possible experience on our website. By continuing to use this website, you agree with our use of cookies. for more information please click HERE