Regent
Regent

Reputation: 5602

How do I embed application manifest in F# application

How can I embed application manifest with my F# application? With C# projects it can be specified in projects properties but I haven't found any similar in F# project.

Upvotes: 3

Views: 491

Answers (3)

Lukas Rieger
Lukas Rieger

Reputation: 786

With VS 2015 and F# 4 (I haven't tested earlier versions, but it probably also works in them) both the compiler and the MSBuild files directly support embedding a manifest in an exe, the option is just not surfaced on the GUI.

You can just add the manifest as a normal file and add the following to your project file:

  <PropertyGroup>
    <ApplicationManifest>app.manifest</ApplicationManifest>
  </PropertyGroup>

This adds the following parameter to the call to the compiler: --win32manifest:app.manifest

Upvotes: 2

Regent
Regent

Reputation: 5602

I've ended up modifying my fsproj-file to contain the following at the end:

  <Target Name="AfterBuild">
    <Exec Command="&quot;C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin\mt.exe&quot; -manifest App.manifest -outputresource:&quot;$(TargetPath)&quot;"
          Condition="('$(OutputType)' == 'Exe' Or '$(OutputType)' == 'WinExe') And Exists('App.manifest')" />
  </Target>

Upvotes: 1

Petr
Petr

Reputation: 4280

Probably the easyest way is using mt.exe tool (Section 2 in this post http://blogs.msdn.com/b/cheller/archive/2006/08/24/how-to-embed-a-manifest-in-an-assembly-let-me-count-the-ways.aspx)

Upvotes: 1

Related Questions