C# Manifest File

Last post 01-31-2008 1:09 PM by Xarzu. 11 replies.
Page 1 of 1 (12 items)
Sort Posts: Previous Next
  • 01-14-2008 11:54 AM

    • Xarzu
    • Top 150 Contributor
    • Joined on 01-09-2008
    • Wannabe Slacker
    • Points 58

    C# Manifest File

    Does anyone know how to declare Manifest Files in the Visual Studio IDE for C#?

  •  Advertisement

    Featured Advertisement

     
  • 01-14-2008 12:10 PM In reply to

    • gbarnett
    • Top 25 Contributor
    • Joined on 01-02-2007
    • Wannabe Slacker
    • Points 716

    Re: C# Manifest File

    I'm not sure you can do with VS tooling but maybe I am wrong.

  • 01-14-2008 12:13 PM In reply to

    • sonu
    • Top 10 Contributor
    • Joined on 05-22-2006
    • Montreal / Canada
    • Slacker
    • Points 12,422
    • MVP

    Re: C# Manifest File

    I don't even see the option in VS2005. Have you already seen the below KB? 

    How to embed a manifest file in an executable file in Visual Studio 2005 

    [MVP since 2005] [MCAD]
    Webmaster of DotNetSlackers
    Question or Suggestion?
    Feel free to ask my any .NET question
    Our Posting FAQ
    Filed under:
  • 01-14-2008 12:16 PM In reply to

    • sonu
    • Top 10 Contributor
    • Joined on 05-22-2006
    • Montreal / Canada
    • Slacker
    • Points 12,422
    • MVP

    Re: C# Manifest File

    Also take a look at the mage.exe and MageUI.exe mentioned in the above KB. I think the exe's should help you out. 

    [MVP since 2005] [MCAD]
    Webmaster of DotNetSlackers
    Question or Suggestion?
    Feel free to ask my any .NET question
    Our Posting FAQ
    Filed under: ,
  • 01-15-2008 8:27 PM In reply to

    • Xarzu
    • Top 150 Contributor
    • Joined on 01-09-2008
    • Wannabe Slacker
    • Points 58

    Re: C# Manifest File

    I did as that link instructed.

    Now I am left wondering this.  After you do a build, you have to open the executable seperately and then attach the manifest file.  So how do I debug the code? 

  • 01-15-2008 8:48 PM In reply to

    • chadmyers
    • Top 10 Contributor
    • Joined on 11-29-2007
    • Wannabe Slacker
    • Points 1,158

    Re: C# Manifest File

    Xarzu,

     

    What are you trying to accomplish with the manifest file, just out of curiosity? 

  • 01-21-2008 7:16 PM In reply to

    • Xarzu
    • Top 150 Contributor
    • Joined on 01-09-2008
    • Wannabe Slacker
    • Points 58

    Re: C# Manifest File

    chadmyers:

    Xarzu,

     

    What are you trying to accomplish with the manifest file, just out of curiosity? 

     

    Getting a C# program with a manifest file to run in the debugger
    ----------------------------------------------------------------

    How do I declare a manifest file in the Visual Studio IDE for C# so that I can debug the resulting code?

    I have been able to add the manifest file, to the exe after I have built the program.  But then, when I try to debug my C# code, the program crashes at the point where a function call is made that is used by the DLL that the manifest file calls.

    I tried the first in the "How to embed a manifest in an assembly: let me count the ways..." (http://blogs.msdn.com/cheller/archive/2006/08/24/how-to-embed-a-manifest-in-an-assembly-let-me-count-the-ways.aspx) link and it failed to produce an executable that I could step through the IDE debugger.  And I followed the steps carefully and I had no build errors.

    I followed the steps outlined here for including a manifest file:
    http://support.microsoft.com/kb/944276

    The executable runs from the command line after I include the manifest file.  But when I open up the debugger and try to run the program through the IDE, it has the same problem as if it does not recognize the manifest file linked to it.

    The way I link the manifest file to the executable is by first building the executable and then I close the project.  Then I open the executable as a separate file and then I attach the manifest file as a resource to the executable.

    The executable can run then, by running it from an explorer window (command line) but if I open the project again, it will not work.

    I got the execuatable produced in the "let me count the ways" to work the same way.  But I need to step through the code.


     

  • 01-21-2008 8:14 PM In reply to

    • chadmyers
    • Top 10 Contributor
    • Joined on 11-29-2007
    • Wannabe Slacker
    • Points 1,158

    Re: C# Manifest File

    Xarzu,

    I dunno, I haven't messed with the Vista UAC stuff (which is what I presume you're trying to do).  If it crashes in the debugger, it's probably some sort of bug with Visual Studio or .NET or Vista or something.

     What happens if you compile the EXE, do the post-compile embed thing, then run the EXE and attach to the running process with Visual Studio (or is it too late by then)?    

  • 01-22-2008 10:15 AM In reply to

    • gbarnett
    • Top 25 Contributor
    • Joined on 01-02-2007
    • Wannabe Slacker
    • Points 716

    Re: C# Manifest File

    Have you tried using WinDbg to find the cause of error?

  • 01-24-2008 7:07 PM In reply to

    • Xarzu
    • Top 150 Contributor
    • Joined on 01-09-2008
    • Wannabe Slacker
    • Points 58

    Re: C# Manifest File

    gbarnett:

    Have you tried using WinDbg to find the cause of error?

    I thought that my problem was how I was declaring a manifest file.
    But now I think I can safely rule this out.

    I think the probem lies in the way I am loading the DLL/COM object
    that the manifest file references.

    The program runs -- sort of.  After I embed the manifest file into
    the executable.  I just cannot step through the code in debug mode.

    So I put the manifest file into the list of files that the IDE had
    to reference.  And then I noticed a big change.  Then the executable
    that I produced had an error message (that I could ignore and continue
    running the program, if I choose to) that said the probem was
    with the way I was loading the COM object.

    How do I load a DLL into a GUI front-end written in C#.  Where
    should I look for possible problems?

    There is something else that interests me.  There is a file that appears
    in some of the output directories called <project name>.vshost.exe.
    How is this used in the project and connected with external COM objects?

    Also, how do I use WinDbg?

  • 01-31-2008 1:09 PM In reply to

    • Xarzu
    • Top 150 Contributor
    • Joined on 01-09-2008
    • Wannabe Slacker
    • Points 58

    Re: C# Manifest File

    gbarnett:

    Have you tried using WinDbg to find the cause of error?

    Here the error display in WinDbg:

    http://i67.photobucket.com/albums/h292/Athono/csharp050.png

    http://i67.photobucket.com/albums/h292/Athono/csharp051.png

    Maybe there is a problem with the way I am using the DLL.  How do I simply add a DLL to a project and expose its methods?  All I am doing is this so far.  I have added the DLL to the Solutions Explorer as a Reference.  Then, in the C Sharp file where I make the function call, I list the DLL at the top of the file as one of the "using" types.  That seems to be all that is done in the code.  What more do I need?

     

     

Page 1 of 1 (12 items)