简体   繁体   中英

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.

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>

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM