F#WPF设置自定义程序集标题

时间:2016-12-28 15:08:57

标签: wpf f#

我正在使用F#WPF设计一个消费者应用程序,我注意到在C#项目中没有相应的AssemblyInfo.cs,我通常可以在其中定义自定义程序集标题。没有它,我的F#应用程序在任务管理器中显示为MyApp.exe,而我希望它只显示为MyApp

This blog post建议手动创建AssemblyInfo.fs。我试过这个:

module AssemblyInfo

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

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

然而它似乎不起作用。

如何在F#应用程序中设置自定义程序集标题?

1 个答案:

答案 0 :(得分:2)

我对此进行了调查,发现AssemblyTitle本身并不充分。您发现,标题将不会出现在任务管理器中。您需要提供更多属性才能使此属性有效,但我不知道哪些属性有所不同。

这是我最初在VS2015中创建的项目中的文件。如果您在VS2013中使用它,请记住为您使用它的每个程序集生成新的GUID。你可以在VS的主菜单中的某个地方做到这一点。或者你可以买 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 ()