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

3
我正在使用F# WPF设计一个消费者应用程序,我注意到在C#项目中没有AssemblyInfo.cs的等效文件,我通常可以在其中定义自定义程序集标题。没有它,我的F#应用程序在任务管理器中显示为MyApp.exe,而我希望它只显示为MyApp这篇博客文章建议手动创建AssemblyInfo.fs。我尝试了这个方法:
module AssemblyInfo

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

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

然而,它似乎并不起作用。

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


2
它为什么“似乎不起作用”? - Fyodor Soikin
你使用哪个IDE或编辑器?使用VS 2015 Community时,当我启动一个新的F#控制台项目时,它会自动生成。 - Guy Coder
@FyodorSoikin 汇编标题仍然缺失于 .exe 文件详细信息中,任务管理器仍然显示 MyApp.exe - Dmitry G.
@GuyCoder 我正在使用VS2013 Pro Update 5。 - Dmitry G.
你尝试过将之前 C# 应用程序中的所有属性都精确指定吗? - Fyodor Soikin
没有,我尝试了只分配AssemblyTitle。不明白它如何依赖于任何其他程序集属性。为了明确起见——我不是将现有的C#应用程序移植到F#。这是一个新的应用程序。 - Dmitry G.
1个回答

2
我进行了调查,发现单独使用AssemblyTitle是不足够的。正如你所发现的那样,该标题将不会出现在任务管理器中。您需要提供更多属性以使此属性起作用,但我不知道哪些属性会产生差异。
这是我原先在VS2015中创建的一个项目文件。如果您在VS2013中使用它,请记得为每个使用它的程序集生成新的GUID。您可以在VS的主菜单中的某个地方执行此操作。或者您可以购买中国制造的高质量GUID

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 ()

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接