NGen.exe

Got a problem you cannot solve? Try here.
ap3000
Posts: 13
Joined: Tue Sep 21, 2010 1:09 am

NGen.exe

Post by ap3000 »

I have a .Net application using the .Net 4 client profile. It make use of DevExpress wpf components and is to slow on start up.

Now I want the installer to run NGen.exe on my main exe and so on all DevExpess dll's that my exe depend on. That works nice if I run the NGen by hand, but I can't get the installer to do it.

If I include all of the DevExpress dll's and then chec "Genrate Native Imahes (ngen)" it works, but I don't like this solution because tomorrow I will add another dll and I then have to remember to include tis one also.

I would rather like just to run the command "ngen install MyExeName ", but then I need the path to the .Netframwork where ngen.exe lives.

How can solve this one?

Please help.

Anders Pedersen
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: NGen.exe

Post by giaviv »

Dear Anders,

I am not sure why you do not like the InstallAware built-in ngen functionality - it is absolutely the best way to achieve your goal. Otherwise, you are relying on 3rd party executables that may or may not exist..

Anyhow, the .NET installation path is written in the following registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\InstallRoot.

Combine the path with your desired framework and you should be all set.
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
ap3000
Posts: 13
Joined: Tue Sep 21, 2010 1:09 am

Re: NGen.exe

Post by ap3000 »

Thanks guaviv,

I would like to use the built in functionality but there I can only use dll's en not my main exe. I then have to put in all of the DevExpress assemblies, but thats not my problem, my problem is if I later add more assemblies and then forget to add them to the Generate Images.

Ik I could use my exe the ngen will automaticly compile all assemblies it depends on.

Anders Pedersen
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: NGen.exe

Post by giaviv »

Dear Anders,

In that case, does my previous answer help you?
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: NGen.exe

Post by giaviv »

Dear Anders,

In that case, does my previous answer help you?
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
ap3000
Posts: 13
Joined: Tue Sep 21, 2010 1:09 am

Re: NGen.exe

Post by ap3000 »

Thanks guaviv,

Yes and No - It's properly more that I'm not sure what hapens here.

If I under "Setup Architechtures -> Assemblies" select my exe and check the "Generate Native Images" will InsallAware then run this command?

Code: Select all

ngen install pathToMyexe\MySoftware.exe
And what happens if I install a new version of my software will InstallAware delete the images before installing the ones from the new version of my software?

Anders Pedersen
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: NGen.exe

Post by giaviv »

Dear Anders,

Yes, except that wont work because you exe is not an assembly and therefore InstallAware will fail when trying to retrieve assembly information from it.

When you uninstall your software (for example during an installation of a new version), your assemblies are removed.
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
ap3000
Posts: 13
Joined: Tue Sep 21, 2010 1:09 am

Re: NGen.exe

Post by ap3000 »

Thanks giaviv,

Sorry I don't get now. Are you saying that InstallAware would't run this if I add my exe and check the "Generate Native Images":

Code: Select all

ngen install pathToMyexe\MySoftware.exe
Or do you say that it would't work?

Because if I run this command at the Command Promt it works just fine.

I would like to know witch command InstallAware exactly run if I add a exe or a dll and check the "Generate Native Images"?

Anders Pedersen
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: NGen.exe

Post by giaviv »

Dear Anders,

That is indeed the command that InstallAware would run BUT the build will fail so the command would never actually run.
When you add files to the assembly list, InstallaAware reads the assembly's information (culture, public key etc). The latter will fail at build time for an exe and therefore you won't be able to build your project.
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
ap3000
Posts: 13
Joined: Tue Sep 21, 2010 1:09 am

Re: NGen.exe

Post by ap3000 »

Dear Aviv,

Thanks for your support, but what ever I do I don't get it right.

I have tried it so as you described - Adding all dll's in the Assemblies section an checked the "Generate Native Images". And I have tried the same with my exe.
But the strange problem is that both methods works on a Windows 32 OS, but on Windows 64 bit OS the Images doesn't get generated. But if I the manually run the "ngen install myexe" it works perfectly.

Why those it work on 32 bit and not 64 bit?
What command those the "Generate Native Images" of InstallAware use?
Can I maybe set a variable withe the path to the highest installed version of .Net framework so that I my self can run the ngen command from the installer?

My exe use the .net 4.0 client profile framework.

Or have any one other suggestions?

Please help.

Anders Pedersen
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: NGen.exe

Post by giaviv »

Dear Anders,

Could you please send me a minimal reproducing project (an empty project created from the Basic Setup template) that demonstrates your problem with your specific assembly (just choose one if there is more) - please send it to support at installaware.com.

Thanks!
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
ap3000
Posts: 13
Joined: Tue Sep 21, 2010 1:09 am

Re: NGen.exe

Post by ap3000 »

Aviv,

I have made test project with the DevExpress standard project in Visual Studio 2010. I have added all the assemblies and checked the "Generate Native Images" This work well with Window 7 32 bit but not with Windows 7 64 bit.

I hope you can help with this.

Also I would like to show the ongoing process in the progress bar and progress label - How do I do that?

Anders Pedersen
Attachments
DXWPFTest.7z
Ngen test project with DevExpress
(3.25 MiB) Downloaded 686 times
giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: NGen.exe

Post by giaviv »

Hey, so I tried running ngen install on one of your DevExpress assemblies - I am not sure it worked. This did not result in the addition of that dll in the \windows\assembly folder. How do you know when the process succeeded? How do you know when it did not?
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
ap3000
Posts: 13
Joined: Tue Sep 21, 2010 1:09 am

Re: NGen.exe

Post by ap3000 »

Aviv,

In the folder ScreenShots I put two images. One of the 32 bit system en one of the 64 system.

It use the Ngen command "ngen display pathtoassembly\assembly.dll". As you can se the win32 it's found and in the win64 not.

Anders Pedersen
ap3000
Posts: 13
Joined: Tue Sep 21, 2010 1:09 am

Re: NGen.exe

Post by ap3000 »

Can some please give helping hand here?

Anders Pedersen
Post Reply