Removing files from ClickOnce application manifest

Home / Removing files from ClickOnce application manifest

We have a ClickOnce application for which we are merging and/or embedding all of our dependency assemblies into a single assembly and obfuscating with Red Gate’s SmartAssembly. ClickOnce doesn’t know about the merging and embedding, so it includes the non-obfuscated individual assembly files when it publishes. It turns out that it’s easy to exclude these files from the deployment at publish-time from Visual Studio.

From Project properties …
Publish tab …
Application Files button …
Select “Exclude” for the Publish Status of the desired files …
Save project …
Publish.

To do this to an already-published ClickOnce application requires more work. Here’s a LINQPad script example to programmatically find a file, remove it and re-sign the appropriate files.