0

Is it possible to use the Native Image Generator (ngen.exe) without administrator privileges?

The MSDN documentation says that you need administrative privileges.

Remarks: To run Ngen.exe, you must have administrative privileges.

As far as I know, you need admin privileges, because the native images are installed into the c:\windows\assembly\... directory.

I would like to know if .NET allows to place the native images in a user config folder, or in the application folder, so you can use ngen.exe without administrative privileges.

The reason for that is that my app installer does not required admin privileges, since it's installed in c:\Users\theuser\appdata\local\... instead of program files.

halfer
  • 18,701
  • 13
  • 79
  • 158
Daniel Peñalba
  • 27,557
  • 31
  • 124
  • 209
  • That is not possible. Creating an installer that modifies the user's machine configuration without telling him about it is evil. And prevented, you can't cheat. UAC is there to *inform* the user, not to stop you from doing what you want to do. – Hans Passant Feb 26 '15 at 11:54
  • @HansPassant: Really my question is if it's possible to place native images in the user config folder or the app folder, without touching the configuration, I'll update my question. – Daniel Peñalba Feb 26 '15 at 11:55
  • Very hard to understand what is ambiguous about "That is not possible". That you don't like that response is obvious enough, that doesn't otherwise magically make it possible. – Hans Passant Feb 26 '15 at 11:56
  • 3
    @HansPassant Your comment seems to basically be saying "no, it's not possible to bypass UAC". This question isn't about bypassing UAC, it's about running Ngen in such a way that it doesn't even attempt to write to system directories. It's very well possible that the answer to that too is "no, that's not possible", but if that's what you meant, that's not clear at all from your comment. –  Feb 26 '15 at 12:16
  • That's not possible. – Hans Passant Feb 26 '15 at 12:22
  • The answer [to this question](http://stackoverflow.com/questions/10100248/is-it-possible-to-pre-generate-ngen-images-so-customers-dont-have-to) explains why it's not possible and why it wouldn't work even if it were possible. –  Feb 26 '15 at 12:25

0 Answers0