Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Use NGEN with WebDeployment

Use NGEN with WebDeployment

Scheduled Pinned Locked Moved C#
c++xmltutorialquestion
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Merlin Tintin
    wrote on last edited by
    #1

    Hello, I'm using WebDeployment to deploy (to install) an intranet web application. I compile all aspx.cs class to one DLL. I have 2 more DLL that are personal libray and that are used by my application. So, I have actually 3 DLL. I would like to use NGEN to create DLL in native code during project installation. NGEN INSTALL MYDLL1.DLL NGEN INSTALL MYDLL2.DLL NGEN INSTALL MYDLL3.DLL Could you tell me how to use NGEN with WebDeployment Project to register my three DLL ? Have I to add command line in project file (XML) - witch section ? Second point: I would like also to use Dotfuscator community 3.0 with WebDeployment - if you have an article on the subject it would be great ! I have tried by when method are renamed to aa, bb, cc. the application don't found anymore the methods of my project... :( Regards,

    La Richesse & la Gloire ne griseront jamais que les temples

    S S 2 Replies Last reply
    0
    • M Merlin Tintin

      Hello, I'm using WebDeployment to deploy (to install) an intranet web application. I compile all aspx.cs class to one DLL. I have 2 more DLL that are personal libray and that are used by my application. So, I have actually 3 DLL. I would like to use NGEN to create DLL in native code during project installation. NGEN INSTALL MYDLL1.DLL NGEN INSTALL MYDLL2.DLL NGEN INSTALL MYDLL3.DLL Could you tell me how to use NGEN with WebDeployment Project to register my three DLL ? Have I to add command line in project file (XML) - witch section ? Second point: I would like also to use Dotfuscator community 3.0 with WebDeployment - if you have an article on the subject it would be great ! I have tried by when method are renamed to aa, bb, cc. the application don't found anymore the methods of my project... :( Regards,

      La Richesse & la Gloire ne griseront jamais que les temples

      S Offline
      S Offline
      Scott Dorman
      wrote on last edited by
      #2

      Merlin Tintin wrote:

      I would like to use NGEN to create DLL in native code during project installation.

      Why do you want to do this? There are very specific reasons for deploying NGEN'd assemblies and specific problems they solve. It's not a general purpose "hammer".

      Scott Dorman

      Microsoft® MVP - Visual C# | MCPD President - Tampa Bay IASA [Blog][Articles][Forum Guidelines]


      Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai

      1 Reply Last reply
      0
      • M Merlin Tintin

        Hello, I'm using WebDeployment to deploy (to install) an intranet web application. I compile all aspx.cs class to one DLL. I have 2 more DLL that are personal libray and that are used by my application. So, I have actually 3 DLL. I would like to use NGEN to create DLL in native code during project installation. NGEN INSTALL MYDLL1.DLL NGEN INSTALL MYDLL2.DLL NGEN INSTALL MYDLL3.DLL Could you tell me how to use NGEN with WebDeployment Project to register my three DLL ? Have I to add command line in project file (XML) - witch section ? Second point: I would like also to use Dotfuscator community 3.0 with WebDeployment - if you have an article on the subject it would be great ! I have tried by when method are renamed to aa, bb, cc. the application don't found anymore the methods of my project... :( Regards,

        La Richesse & la Gloire ne griseront jamais que les temples

        S Offline
        S Offline
        Simon P Stevens
        wrote on last edited by
        #3

        I agree with Scott here. I can't think of any good reason to use NGEN on a web app. All NGEN does is pre-JIT the IL to native assembly. This has lots of implications as it means the CLR can no longer run optimisations as it jits. The CLR is very effcient, it can often optimise things as it goes along because it knows the context it is running in. By using NGEN you remove that optimisation. The normal performance benifit associated with NGEN is improved cold start up times as the CLR doesn't have to jit compile methods before it can run them. Once the app is started though, the CLR caches jit compiled stuff so it doesn't have to do it again. By the very nature of a web app, cold start up time is irrelevant, it is just continuously running, so only the very first user will experience any slow down related to jitting, after that, the assembly is cached and no more jit compilation is required.

        Simon

        M 1 Reply Last reply
        0
        • S Simon P Stevens

          I agree with Scott here. I can't think of any good reason to use NGEN on a web app. All NGEN does is pre-JIT the IL to native assembly. This has lots of implications as it means the CLR can no longer run optimisations as it jits. The CLR is very effcient, it can often optimise things as it goes along because it knows the context it is running in. By using NGEN you remove that optimisation. The normal performance benifit associated with NGEN is improved cold start up times as the CLR doesn't have to jit compile methods before it can run them. Once the app is started though, the CLR caches jit compiled stuff so it doesn't have to do it again. By the very nature of a web app, cold start up time is irrelevant, it is just continuously running, so only the very first user will experience any slow down related to jitting, after that, the assembly is cached and no more jit compilation is required.

          Simon

          M Offline
          M Offline
          Merlin Tintin
          wrote on last edited by
          #4

          I agree with you for optimization - but optimization is not my main goal. My main goal is to protect the embeded code of my page and the framework that I put on the client server. My application is installed on all over the world on server that are the property of clients. So, I would like to use NGEN to put my code less (easier) readable. Fo that I have a plan. Each point is pretty simple to complete but the whole thing is more difficult because each feature is not predict to use other. Here is my steps to protect the .NET code (as strong as possible) - sign the assembly - All code of pages are in not single class but in a global DLL. This is realize with WebDeploymentProject - Compile in native code (NGEN). Put the code less readeable for decompilation. - Obfusacte the code with Dotfuscator Community 3.0 I realize each step without any problem but I cannot figure out how to implement everything together. ps: I have a click one install to install the web application. I hope this is more clear for you and I'm open to any other suggestion to protect the code efficiently.

          La Richesse & la Gloire ne griseront jamais que les temples

          D S 2 Replies Last reply
          0
          • M Merlin Tintin

            I agree with you for optimization - but optimization is not my main goal. My main goal is to protect the embeded code of my page and the framework that I put on the client server. My application is installed on all over the world on server that are the property of clients. So, I would like to use NGEN to put my code less (easier) readable. Fo that I have a plan. Each point is pretty simple to complete but the whole thing is more difficult because each feature is not predict to use other. Here is my steps to protect the .NET code (as strong as possible) - sign the assembly - All code of pages are in not single class but in a global DLL. This is realize with WebDeploymentProject - Compile in native code (NGEN). Put the code less readeable for decompilation. - Obfusacte the code with Dotfuscator Community 3.0 I realize each step without any problem but I cannot figure out how to implement everything together. ps: I have a click one install to install the web application. I hope this is more clear for you and I'm open to any other suggestion to protect the code efficiently.

            La Richesse & la Gloire ne griseront jamais que les temples

            D Offline
            D Offline
            Daniel Grunwald
            wrote on last edited by
            #5

            NGEN is meant to improve startup-time, it's not meant to protect your code. AFAIK there's no way to use an NGEN image on its own, you must also ship the original .NET assembly.

            1 Reply Last reply
            0
            • M Merlin Tintin

              I agree with you for optimization - but optimization is not my main goal. My main goal is to protect the embeded code of my page and the framework that I put on the client server. My application is installed on all over the world on server that are the property of clients. So, I would like to use NGEN to put my code less (easier) readable. Fo that I have a plan. Each point is pretty simple to complete but the whole thing is more difficult because each feature is not predict to use other. Here is my steps to protect the .NET code (as strong as possible) - sign the assembly - All code of pages are in not single class but in a global DLL. This is realize with WebDeploymentProject - Compile in native code (NGEN). Put the code less readeable for decompilation. - Obfusacte the code with Dotfuscator Community 3.0 I realize each step without any problem but I cannot figure out how to implement everything together. ps: I have a click one install to install the web application. I hope this is more clear for you and I'm open to any other suggestion to protect the code efficiently.

              La Richesse & la Gloire ne griseront jamais que les temples

              S Offline
              S Offline
              Simon P Stevens
              wrote on last edited by
              #6

              Ahh, I see. Interesting Idea, but unfortunately that won't work. NGEN takes your IL assembly and compiles it to processor specific machine code, and places this machine code in a native image cache on the PC that NGEN was run on. You can't then copy this machine code onto another PC. You also can't delete the original IL assembly as that will also delete the machine code from the native image cache. What happens when you run your app then is the CLR first checks the native image cache to see if it's already been compiles, if it finds stuff in the cache it uses that. running NGEN on an assembly gives you no extra protection from disassembly. It can still be disassembled and reflected on. All the meta data included with a normal assembly is still present. If you are concerned with clients seeing your code your only real option is an obfuscater. (Signing the assembly does not prevent it being viewed, it only means other people can identify it as your work. Other people can even still change it, but if they change 1 assembly, they have to recompile them all as signing with a strong name ensures other assemblies will only call the original one they were referenced to.) Ultimately, C# (even with an obfuscater) is not 100% foolproof at hiding code. If you have critical proprietary algorithms that must be hidden, most people would recommend implementing the critical bits in unmanaged code.

              Simon

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups