How can I ngen a .net3.5-targeted gac-installed DLL on a system with only .net4? RRS feed

  • Question

  • Greetings,

    My application installs a DLL to the GAC using MSI/WiX.  Since I'm not using any of .NET 4's functionality, and I don't want to force my users to download the framework, the DLL targets .NET 3.5.  However, it seems this prevents me from running ngen to generate native images if the user only has .NET 4 installed.  ngen simply fails to load the DLL.  The problem seems to be that there needs to be an app.config file specifying (with supportedRuntime) that my application supports .NET 4, or ngen can't load it.  But, how can I do that if the DLL is in the GAC?

    This is quite frustrating.

    Friday, April 15, 2011 5:06 PM



    Hi Paul,


    Welcome to the MSDN forum!


    .NET Framework 4 is different from .NET Framework 3.5.

    What's New in the .NET Framework 4


    Generally speaking, .NET Framework 4 loads CLR 4 that .NET Framework 3.5 loads CLR2. And unfortunately, if the application targets .NET Framework 3.5, you have to install .NET Framework 3.5 on the target machine that cannot be instead of .NET Framework 4.


    Have a nice day!

    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Paul Zhou Monday, April 25, 2011 3:31 AM
    Wednesday, April 20, 2011 9:06 AM