1

Following these steps for adding a UAC manifest to my C# project embedded as a resource.

Step 1 works fine, I create the RC file in my project as a simple text file as described.

#include <winuser.h>
#define IDR_MANIFEST 1 // 2 for a DLL

IDR_MANIFEST RT_MANIFEST MOVEABLE PURE
{
 "<assembly xmlns=""urn:schemas-microsoft-com:asm.v1"" manifestVersion=""1.0"">
   <asmv3:trustInfo xmlns:asmv3=""urn:schemas-microsoft-com:asm.v3"">
     <asmv3:security>
       <asmv3:requestedPrivileges>
         <asmv3:requestedExecutionLevel
           level=""asInvoker""
           uiAccess=""false"" />
       </asmv3:requestedPrivileges>
     </asmv3:security>
   </asmv3:trustInfo>
  </assembly>"
}

Then using the Visual Studio Command Prompt, I get the following output at step 2:

  c:\myproject>rc MyResourceFile.rc
  Microsoft (R) Windows (R) Resource Compiler Version 6.1.6723.1
  Copyright (C) Microsoft Corporation.  All rights reserved.


  ConfigurationManager.rc(4) : error RC2135 : file not found: 1

I assume this is something quite dumb, right?

Epaga
  • 38,231
  • 58
  • 157
  • 245

5 Answers5

1

Make sure the rc file is UTF-8 encoded. I tried to compile a ANSI or UTF-8 BOM encoded file and I was receiving this error message.

Fredrick
  • 1,210
  • 2
  • 15
  • 24
1

No repro, I don't see anything wrong. The C# compiler already embeds a UAC manifest into the assembly since VS2008 (possibly VS2005 SP1 for Vista). If you want to modify it then use Project + Add New Item and select the "Application Manifest File" item template.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
  • problem is that i have an external build job building my dll dependencies first, and then building my exe file, so i want to embed the manifest. but this answer is closest to what i needed so i'll accept it. thanks! – Epaga Dec 14 '10 at 15:22
0

Try using

include "winuser.h"

instead of

include <winuser.h>

i.e. replace '<>' with double qoutes.

Community
  • 1
  • 1
Ammar Hasan
  • 2,436
  • 16
  • 22
0

As Hans Passant said, starting with VS 2008 you can simply directly add the manifest file to the project. Then under the properties of the project, select the "application" tab and choose the manifest file from the ComboBox "Manifest:".

Daniel Rose
  • 17,233
  • 9
  • 65
  • 88
0

I ended up using mt.exe to embed the manifest in the .exe file in a post-build step. But Hans's answer was close enough. So I guess the mystery of the "File Not Found" will remain unsolved...

Epaga
  • 38,231
  • 58
  • 157
  • 245