Configure Application Pool .NET CLR Version using C# .NET Core

2.1k Views Asked by At

When trying to assign a Managed RunTime Version version with this code:

using (ServerManager serverManager = new ServerManager())
    {
       ApplicationPool newAppPool = serverManager.ApplicationPools.Add("HICS");
       newAppPool.ManagedRuntimeVersion = "No Managed Code";
    }

It sets the version to "No Managed Code", but it's not the right selection. I end up with this: enter image description here

If I select the other "No Managed Code", the App Pool works just fine. Why is it creating a duplicate option? How can I select the existing "No Managed Code"? Using C# code of course..

1

There are 1 best solutions below

0
Broots Waymb On

Try setting it to "", like in this answer. It should still work, although they are setting this value in a slightly different method.

using (ServerManager serverManager = new ServerManager())
{
   ApplicationPool newAppPool = serverManager.ApplicationPools.Add("HICS");
   newAppPool.ManagedRuntimeVersion = "";
}