在编译时设置 app.manifest 中包含的属性

Setting the Properties included in the app.manifest at compile time

我的一个项目中有以下清单(创建于 Visual Studio 2013,使用 C#)。

<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <assemblyIdentity version="5.4.0.5" name="Device"/>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"><security><requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"><requestedExecutionLevel level="highestAvailable" uiAccess="false" /></requestedPrivileges></security></trustInfo>
  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"><application></application></compatibility>
</asmv1:assembly>

"assemblyIdentity"标签包含项目名称和版本;有没有办法用代码标记此属性,以便在编译时从项目中获取这两个值,而不是在文件中更改它?

只是用我发现并解决了我的需求的东西来结束这个,在 MSDN's page 他们展示了如何指定构建事件 (C#) 并使用构建事件作为示例来更改应用程序清单。