Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8238775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:55:42+00:00 2026-06-07T19:55:42+00:00

I was just tasked with upgrading an internal enterprise web application. The user enters

  • 0

I was just tasked with upgrading an internal enterprise web application. The user enters some data, and the web app then compiles a custom winforms EXE (self-extractor/installer type of app), and then the website serves it up as a download.

We recently learned this custom-compiled installer displays a compatibility error/warning in Windows 7. After some research I learned that I will need to provide an Application Manifest that specifies compatibility with Windows 7:

Related links:

  • Stackoverflow article detailing the Windows 7 compatibility error
  • MSDN Article which details what is required in the Application Manifest
  • Sample code which shows how to set the compiler options

This is my first experience with custom/dynamically-compiled code, and application manifests.

Since this app is compiled on the fly (from a single code file and some embedded resources), I can’t just add a manifest to my project. So I used the compiler’s “/win32manifest” compiler option to reference the manifest file when compiling.

Here is a bit of code from the custom “Archive Compiler” class that actually does the compilation: (I’ve only added the Application Manifest portion)

public void CompileArchive(string archiveFilename, bool run1stItem, string iconFilename)
{
    CodeDomProvider csc = new CSharpCodeProvider();
    CompilerParameters cp = new CompilerParameters();

    cp.GenerateExecutable = true;
    cp.OutputAssembly = archiveFilename;
    cp.CompilerOptions = "/target:winexe";

    // Custom option to run a file after extraction  
    if (run1stItem) {
        cp.CompilerOptions += " /define:RUN_1ST_ITEM";
    }
    if (!string.IsNullOrEmpty(iconFilename)) {
        cp.CompilerOptions += " /win32icon:" + iconFilename;
    }
    cp.ReferencedAssemblies.Add("System.dll");
    cp.ReferencedAssemblies.Add("System.Windows.Forms.dll");

    // Add application manifest to specify operating system compatibility (to fix compatibility warning in Windows 7)
    string AppManifestPath = Path.Combine( System.Web.HttpContext.Current.Server.MapPath( "~/Content/" ), "CustomInstaller.exe.manifest" );
    if ( File.Exists( AppManifestPath ) ) {
        cp.CompilerOptions += string.Format( " /win32manifest: \"{0}\"", AppManifestPath );
    }

    // Add compressed files as resource
    cp.EmbeddedResources.AddRange(filenames.ToArray()); 

    // Compile standalone executable with input files embedded as resource
    CompilerResults cr = csc.CompileAssemblyFromFile(cp, sourceCodeFilePath);

    // yell if compilation error
    if (cr.Errors.Count > 0) {
        string msg = "Errors building " + cr.PathToAssembly;
        foreach (CompilerError ce in cr.Errors) { msg += Environment.NewLine + ce.ToString(); }
        throw new ApplicationException(msg);
    }
}

However, when I compile, I keep running into this error:

Errors building D:\Projects\MySolution\WebAppName\App_Data\MyUsername\CustomInstaller.exe
error CS2007: Unrecognized option: ‘/win32manifest:’

I’m having trouble finding information on this, other than articles which state that this parameter exists and is valid. The web app is in visual studio 2010 and runs on framework 2.0. The dynamically compiled app references .net 2.0 as well (verified with a decompiler). I’m not sure what EXE gets called to perform the compilation, or what else I could check to troubleshoot this. Any help would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T19:55:45+00:00Added an answer on June 7, 2026 at 7:55 pm

    After more research, I learned about mt.exe, which is a simple command line utility for adding application manifests. I put a copy of the exe into my web project, and then added code to call this process after the app was compiled:

    //Add an application manifest using mt.exe
    System.Diagnostics.Process process = new System.Diagnostics.Process();
    System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
    startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
    startInfo.FileName = Path.Combine( System.Web.HttpContext.Current.Server.MapPath( "~/Content/" ), "mt.exe" );
    string AppManifestPath = Path.Combine( System.Web.HttpContext.Current.Server.MapPath( "~/Content/" ), "CustomInstaller.exe.manifest" );
    startInfo.Arguments = string.Format( "-nologo -manifest \"{0}\" -outputresource:\"{1};#1\"", AppManifestPath, cp.OutputAssembly );
    process.StartInfo = startInfo;
    process.Start();
    process.WaitForExit( 10000 ); //wait until finished (up to 10 sec)
    

    This successfully adds my manifest to the compiled EXE quickly and easily. I also found this Manifest Viewer which made it easy to verify the content of my manifest.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've just been tasked with building a web application using ASP (.net) and am
I have been tasked with setting up an internal web application to become public
I just inherited an ASP.NET WebForms web application that I was tasked with refactoring.
I have recently been tasked with upgrading an application from .net 1.1 to 3.5
I've been tasked with converting a legacy application to mvc. The app used pgp.exe
OKay, I'm from a PHP background, but I've just been tasked with developing some
OK so I've been tasked with upgrading an application which involves updating schema in
I have just joined a team working on an existing Java web app. I
I am tasked to integrate a CF code(about 70 lines) into our site then
I've been tasked to create a PHP app which accesses an existing PostgreSQL database.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.