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

标签 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# 应用程序中设置自定义程序集标题?

最佳答案

我对此进行了调查,发现仅靠 AssemblyTitle 是不够的。如您所见,该标题将不会出现在任务管理器中。您需要提供更多属性才能使此属性起作用,但我不知道哪些属性有所不同。

这是我最初在 VS2015 中创建的项目中的文件。如果您在 VS2013 中使用它,请记住为您使用它的每个程序集生成一个新的 GUID。您可以在 VS 主菜单中的某处执行此操作。或者你可以买 quality GUIDs made in China .

程序集信息.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 ()

关于wpf - F# WPF 设置自定义程序集标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41364717/

相关文章:

c# - 如何从 CefSharp 3 在 native 浏览器中打开链接

c# - AvalonDock 2.0 LayoutRoot.LeftSide 宽度

c# - .NET 优先框架 3.5 的折线图

.net - 您可以将列表框中的选定项绑定(bind)到 WPF 中的单独对象吗?

datetime - F#,小类型推断/注释错误

c# - 您认为 F# 的异步工作流将来会在 C# 中引入吗?

c# - WPF 中的 Application.DoEvents() 在哪里?

f# - 通过函数调用区分联合模式匹配

c# - 可变 F# 记录的二进制序列化

F# 遍历集合并构建列表