如何在Rider中创建可用的app.manifest文件



IDE:Jetbrains Rider,C#,.NET 6.0,Windows 10

我需要编辑app.manifest,因为应用程序需要管理员权限才能执行一些netsh命令来更改windows防火墙。每次我尝试启动程序时,它都会崩溃,因为我的app.manifest中有一些内容不正确。我可以以某种方式生成app.manifest,或者复制模板之类的吗?

在app.manifest中,我有<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />

在我的.csproj文件中,这就是我的<propertygroup>的样子:

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>

提前感谢!

构建应用程序时嵌入程序集中的默认清单如下所示:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" name="YourAppName.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>

您可以根据自己的要求进行复制和编辑。

最新更新