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

  • Home
  • SEARCH
  • 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 7080011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:44:33+00:00 2026-05-28T06:44:33+00:00

I have this code that should nGen my main application EXE: using System; using

  • 0

I have this code that should nGen my main application EXE:

using System;
using System.Collections;
using System.ComponentModel;
using System.Configuration.Install;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;

namespace FileOnline.DesktopClient.Setup.Support {
    [RunInstaller(true)]
    public partial class CustomNGen : Installer {

        public override void Install(IDictionary stateSaver) {
            base.Install(stateSaver);
            ExecuteNGen("install", true);
        }

        public override void Uninstall(IDictionary savedState) {
            base.Uninstall(savedState);
            //CleanUpShortcuts();
            ExecuteNGen("uninstall", false);
        }

        private void ExecuteNGen(string cmd, bool validate) {
            var ngenStr = Path.Combine(RuntimeEnvironment.GetRuntimeDirectory(), "ngen");
            var assemblyPath = Context.Parameters["assemblypath"];

            using (var process = new Process {
                StartInfo = {
                    FileName = ngenStr,
                    Arguments = string.Format(@"{0} ""{1}""", cmd, assemblyPath),
                    CreateNoWindow = true,
                    UseShellExecute = false
                }
            }) {
                process.Start();
                process.WaitForExit();

                if (validate && process.ExitCode != 0)
                    throw new Exception(String.Format("Ngen exit code: {0}", process.ExitCode));
            }
        }

    }

}

What I require is that not only the EXE be nGen’d, but all the referenced DLLs (my whole solution) also get nGen’d

Say my EXE project is called:

FileOnline.DesktopClient

And it depends on these:

FileOnline.DesktopClient.BaseControls
FileOnline.DesktopClient.BaseForms
FileOnline.DesktopClient.Utilities
FileOnline.DesktopClient.Dialogboxes
FileOnline.DesktopClient.HelpingExtension
FileOnline.DesktopClient.*More stuff*

How can I nGen these through the only deployment project in the solution?

Thanks.

  • 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-05-28T06:44:33+00:00Added an answer on May 28, 2026 at 6:44 am

    It is automatic, ngen.exe finds those assemblies through Assembly.GetReferencedAssemblies(). You’d only have to take care of assemblies you load yourself with Assembly.Load/From(). Review the /execonfig option if you have unusual binding rules in the .exe.config file, ngen.exe needs to know those too so it can find the proper assembly.

    Alternative methods are here and here.

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

Sidebar

Related Questions

I have this program that should execute a piece of code base on the
I have got a piece of code, that should countdown some number (in this
I have this code that fetches some text from a page using BeautifulSoup soup=
i have this code that should create a dialog with the page google inside
I have this code that loads an xml file using javascript: function getXmlDocument(sFile) {
I have this code that should change the color of a dynamic textfield when
hey, I have this code that should save a java.util.Vector of custom serializable classes:
I have this code that should display a list of values from an array
I have this code that should read an unset preference on the first run:
I have this php code that should take all the php files in a

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.