"Activation context generation failed" complaint trying to add an application manifest
Asked Answered
H

3

6

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>
Houghton answered 27/5, 2009 at 20:50 Comment(2)
Just to make sure it isn't a typo, but your manifest file does have the closing </asmv1:assembly> tag in it, yes?Basketry
Also, can you post the code for your WinUI.exe.Config file. There could be a problem there.Basketry
H
9

I found the solution.

The encoding specified in the MyCompany.MyProduct.WinUI.exe.Config is not supported.

<?xml version="1.0" encoding="iso-8859-1"?>

I changed the encoding to utf-8, and everything work fine...

<?xml version="1.0" encoding="utf-8"?>
Houghton answered 28/5, 2009 at 15:27 Comment(1)
this did the trick. i suppose the manifest parser must be looking at the config files, even if only in passing.Radcliffe
K
3

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.

Kiakiah answered 27/5, 2009 at 20:54 Comment(1)
Sory for that... My file did contains the missing closing tag </asmv1:assembly>. I probably delete it when I was formatting the post..Houghton
B
0

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.

Bretbretagne answered 19/6, 2015 at 15:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.