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:
Create a dummy applicationname.exe.lic placeholder and include in your solution. Change the Build Action property of your *.lic in VS to Content type. Change Copy to output directory setting to Copy if newer. Set your post build event as:
\ApplicationSignerConsole.exe $(TargetPath) “your key” “info1” “info2” 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.
In the new versions of MSBuild, there is a workaround necessary to get the order of .NET signing of the assembly and DicomObjects licensing correct.
<!-- 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.