简体   繁体   中英

F# WPF set custom assembly title

I'm designing a consumer application using F# WPF and I noticed that there is no equivalent of AssemblyInfo.cs in C# projects where I can usually define custom assembly title. Without it my F# app is shown in the Task Manager as MyApp.exe while I want it to be shown as just MyApp .

This blog post recommends creating AssemblyInfo.fs manually. I tried this:

module AssemblyInfo

open System  
open System.Reflection;  
open System.Runtime.InteropServices;  

[<assembly: AssemblyTitle("MyApp")>]
do()

however it doesn't seem to work.

How do I set custom assembly title in an F# application?

I investigated this, and discovered that AssemblyTitle on its own is not sufficient. The title will then not appear in Task Manager, as you found out. You need to supply with more attributes in order to make this attribute work, but I don't know which ones makes the difference.

This is a file from a project of mine originally created in VS2015. If you use it in VS2013, remember to generate a new GUID for each assembly where you use it. You can do that somewhere in the main menu of VS. Or you can buy quality GUIDs made in China .

AssemblyInfo.fs

namespace SecondDemo.AssemblyInfo

open System.Reflection
open System.Runtime.CompilerServices
open System.Runtime.InteropServices

// General Information about an assembly is controlled through the following 
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[<assembly: AssemblyTitle("SecondDemo")>]
[<assembly: AssemblyDescription("")>]
[<assembly: AssemblyConfiguration("")>]
[<assembly: AssemblyCompany("")>]
[<assembly: AssemblyProduct("SecondDemo")>]
[<assembly: AssemblyCopyright("Copyright ©  2017")>]
[<assembly: AssemblyTrademark("")>]
[<assembly: AssemblyCulture("")>]

// Setting ComVisible to false makes the types in this assembly not visible 
// to COM components.  If you need to access a type in this assembly from 
// COM, set the ComVisible attribute to true on that type.
[<assembly: ComVisible(false)>]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[<assembly: Guid("827700cd-54f6-4485-9239-fbd6af43c3e5")>]

// Version information for an assembly consists of the following four values:
// 
//       Major Version
//       Minor Version 
//       Build Number
//       Revision
// 
// You can specify all the values or you can default the Build and Revision Numbers 
// by using the '*' as shown below:
// [<assembly: AssemblyVersion("1.0.*")>]
[<assembly: AssemblyVersion("1.0.0.0")>]
[<assembly: AssemblyFileVersion("1.0.0.0")>]

do ()

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