是否可以在.NET Core Web应用程序的任务管理器中设置显示名称?

时间:2019-01-03 13:10:28

标签: c# windows visual-studio

我有一个.Net Core 2.0 Web应用程序,我想在任务管理器中显示该名称。当前显示.NET Core Host

enter image description here

我已经找到了this question,但是很遗憾,无法更改程序集信息,因为甚至没有显示此窗口(我认为这是因为它是.NET Core 2.0应用程序,而不是.NET Framework, 4.x应用程序。)

enter image description here

还有另一种在任务管理器中显示应用程序标题的方法吗?

2 个答案:

答案 0 :(得分:1)

如果从dll运行应用程序-否,则没有办法,因为需要DotnetCore-Hosting-Process来运行它。

如果将应用程序部署为self-contained application,它将显示您将AssemblyName / Executable设置为的名称:

.csproj:

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
    <AssemblyName>Hello World</AssemblyName>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.0</TargetFramework>
  </PropertyGroup>
<PropertyGroup>
   <RuntimeIdentifiers>win10-x64</RuntimeIdentifiers>
</PropertyGroup>
</Project>

enter image description here

也请仔细阅读发布自包含应用here的后果。

答案 1 :(得分:1)

我设法通过在.net core 3.1的.csproj文件中设置AssemblyTitle值来设置显示名称:

.csproj

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
    <AssemblyName>Hello World</AssemblyName>
    <AssemblyTitle>Display Name</AssemblyTitle>
    <OutputType>WinExe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>
</Project>