I\'m working on automating the installer for a .NET 4.0 ClickOnce WPF application, which needs a few items to be set in the app.config file. I\'ve gone through the thor
I also needed to add CompatibleFrameworks. I also tried do add the CompatibleFrameworks like this (which does not work)
dm.CompatibleFrameworks.Add(...);
My solution was to set:
dm.TargetFrameworkMoniker = ".NETFramework,Version=v4.0";
After this the Manifest generation was correct.
Be careful If you set the TargetFrameworkMoniker before WriteManifest you have the
DeployManifest dm = ManifestReader.ReadManifest("DeployManifest", applicationFileName, false) as DeployManifest;
dm.ResolveFiles();
//doing stuff..
dm.UpdateFileInfo();
ManifestWriter.WriteManifest(dm, applicationFileName);
dm.TargetFrameworkMoniker = ".NETFramework,Version=v4.0";
ManifestWriter.WriteManifest(dm, applicationFileName);