Installing ASP.NET 2.0 Application -ensure that it runs ASP.Net 2.0

For my Web Setup (created by MS Visual Studio Setup Project)  I wanted to ensure that a new web application runs ASP.Net 2.0.

Pointed by this thread, I downloaded  IIS Chameleon“.

I’ve changed the assembly toDLL, excluded Non GUI classes, made ASPNetVersion,INETMGRHelper and CURRENT_RUNTIME_VERSION public and also changed definitions.xml to be embedded resource(may be not a good idea, because it will not allow to customize, but easier to distribute).

I also changed GetAllASPNETVersions to read from ResourceStream.

            Assembly asm = Assembly.GetExecutingAssembly();
            Stream stream1 = StreamHelper.GetManifestResourceStream(APP_DEFINITIONS_FILENAME,asm );//definitions.xml

Now my installer custom action calls the function

   Sub EnsureIISAppVer2(ByVal VDir As String, ByVal Site As String, ByVal Port As String)

        ‘ map IISSite to Site

        Trace.WriteLine(“EnsureIISAppVer2 VDir “ & VDir & ” Site “ & Site & ” Port “ & Port)

        Dim oVdir As New IISChameleon.IISVirtualDir()

        oVdir.MetabasePath = Site & “/root/” & VDir ‘Site has format @”/LM/W3SVC/1″;

        oVdir.ASPNetVersion = IISChameleon.INETMGRHelper.CURRENT_RUNTIME_VERSION

        Dim helper As New IISChameleon.INETMGRHelper()


     End Sub