“激活上下文生成失败” 投诉尝试添加应用程序清单
我正在尝试添加需要提升到 .NET 2.0 EXE 的应用程序清单。 我已经为一个简单的 EXE 做到了这一点,并且它工作没有任何问题,但在这个更复杂的 EXE 上它不起作用。
我的 EXE 有一个配置文件和解决方案中其他 DLL 的许多依赖项。
当我启动 EXE 时,出现 SideBySide 错误,提示““C:\MyCompany.MyProduct.WinUI.exe”的激活上下文生成失败。清单或策略文件“C:\MyCompany.MyProduct.WinUI”中出现错误。 exe.Config”第 1 行。无效的 Xml 语法。
”
我的配置文件与清单文件有什么关系? 这是我的清单:
<?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="2.10.0.0" name="MyCompany.MyProduct.WinUI"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
</asmv1:assembly>
I'm trying to add an application manifest that requires elevation to my .NET 2.0 EXE.
I've done that for a simple EXE and it worked without any problems, but on this more complex EXE it's not working.
My EXE has a config file and a lot of dependencies of other DLLs in my solution.
When I start the EXE, I get a SideBySide error saying "Activation context generation failed for "C:\MyCompany.MyProduct.WinUI.exe".Error in manifest or policy file "C:\MyCompany.MyProduct.WinUI.exe.Config" on line 1. Invalid Xml syntax.
"
What does my config file have to do with the manifest file? Here is my manifest:
<?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="2.10.0.0" name="MyCompany.MyProduct.WinUI"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
</asmv1:assembly>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我的问题是我的应用程序配置中的 XML 无效,应用程序设置元素以两个引号结束 -> “”
当我删除第二个 -> “我的控制台应用程序运行良好,毫无疑问是一个误导性错误。
my issue with this was that i had invalid XML in my App,Config, an app setting element closing with two quotes -> ""
as soon as i removed the second -> " my console app worked fine, a misleading error no doute.
您没有关闭 asmv1: assembly 标记。
另外,尝试下载 XML 记事本 并将您的 XML 加载到其中。 它非常擅长告诉你你做错了什么。
You didn't close the asmv1:assembly tag.
Also, try downloading XML Notepad and loading your XML into it. It's very good at telling you what you did wrong.
我找到了解决方案。
不支持 MyCompany.MyProduct.WinUI.exe.Config 中指定的编码。
我将编码更改为utf-8,一切正常...
I found the solution.
The encoding specified in the MyCompany.MyProduct.WinUI.exe.Config is not supported.
I changed the encoding to utf-8, and everything work fine...