Reputation: 717
I need to install some script/application that runs every time at startup and performs some operations under the user privileges.
My script would check whether the current version of certain .NET application (which runs very slow if not compiled, very fast if compiled) has been compiled. If negative, it would compile it (with NGEN.EXE
). As we know the .NET apps must be compiled on a machine-by-machine basis.
This check must be performed every time the machine starts up.
Question: Would you recommend to implement this with C#, C++ or with some script? Can you please provide details?
TIA.
Upvotes: 0
Views: 207
Reputation: 717
Esteemed Self:
All you need to do is determine the date of MyApp.exe
and compare it with the date of
C:\Windows\assembly\NativeImages*\*\MyApp.ni.exe
If the latter is older, you need to recompile.
You are welcome.
Upvotes: 1
Reputation: 941347
There isn't any point in trying to find out, ngen.exe already can do this by itself. Just run:
ngen.exe update /queue
The update command tells it to look for native images that are no longer valid. The /queue option tells it to perform the job in the background.
Targeting a specific assembly is done with
ngen.exe assemblypath install /queue
Upvotes: 2