3
votes

I'm try to use mage.exe (located in "C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\mage.exe") to generete clickonce files from application targeting .Net 4.5. Exerything works fine but in *.application file there is a section "compatibleFrameworks":

  <compatibleFrameworks xmlns="urn:schemas-microsoft-com:clickonce.v2">
    <framework targetVersion="4.0" profile="Client" supportedRuntime="4.0.30319" />
    <framework targetVersion="4.0" profile="Full" supportedRuntime="4.0.30319" />
  </compatibleFrameworks>

I don't know why framework is set to 4.0. I'd like to get finally .Net 4.5 in generated files, so something like this:

<compatibleFrameworks xmlns="urn:schemas-microsoft-com:clickonce.v2">
    <framework targetVersion="4.5" profile="Full" supportedRuntime="4.0.30319" />
  </compatibleFrameworks>

What should I change? Why merge.exe doesn't set correct version on compatibile framework? I don't want to modify this manually.

1
Do you target 4.5 full framework in your project settings?Vojtěch Dohnal
Yes. Target framework in project properties is set to: .Net Framework 4.5. If I run Publish from VS, generated files contain correct information about compatible framework.user3896104
Strange, for me C:\Program Files\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\MAGE.exe generates this OK...Vojtěch Dohnal
How does your command look?user3896104

1 Answers

5
votes

The compatible frameworks version is set differently depending on which version of Mage is used. I am not aware of any versions of mage that set the target version to 4.5. Mage is not a complete tool and there are various changes that Microsoft recommend that you perform manually using a text editor. I am using Powershell to edit my manifests after creating them with mage. You could probably manually change the targetVersion attribute to 4.5 and then re-sign the manifest.

Mage 3.5.30729.1

C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\mage.exe

No compatibleFrameworks element in file

Mage 4.0.30319.18020

C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\mage.exe

<compatibleFrameworks xmlns="urn:schemas-microsoft-com:clickonce.v2">
  <framework targetVersion="4.0" profile="Client" supportedRuntime="4.0.30319" />
  <framework targetVersion="4.0" profile="Full" supportedRuntime="4.0.30319" />
</compatibleFrameworks>

Mage 4.0.30319.33440

C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\mage.exe

<compatibleFrameworks xmlns="urn:schemas-microsoft-com:clickonce.v2">
  <framework targetVersion="4.0" profile="Client" supportedRuntime="4.0.30319" />
  <framework targetVersion="4.0" profile="Full" supportedRuntime="4.0.30319" />
</compatibleFrameworks>

Mage 4.6.81.0

C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\mage.exe

<compatibleFrameworks xmlns="urn:schemas-microsoft-com:clickonce.v2">
  <framework targetVersion="4.6" profile="Client" supportedRuntime="4.0.30319" />
  <framework targetVersion="4.6" profile="Full" supportedRuntime="4.0.30319" />
</compatibleFrameworks>

Mage 4.6.1055.0

C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\mage.exe

<compatibleFrameworks xmlns="urn:schemas-microsoft-com:clickonce.v2">
  <framework targetVersion="4.6" profile="Client" supportedRuntime="4.0.30319" />
  <framework targetVersion="4.6" profile="Full" supportedRuntime="4.0.30319" />
</compatibleFrameworks>