internal static void GenerateWebConfig( WebApplication application, WebProject project )
        {
            var sections = new XmlDocument { PreserveWhitespace = true };
            using( var reader = new StringReader( getSectionString( project ) ) )
                sections.Load( reader );

            if( !File.Exists( application.WebConfigFilePath ) )
                throw new UserCorrectableException( "The {0} file is missing.".FormatWith( WebApplication.WebConfigFileName ) );
            var webConfig = new XmlDocument { PreserveWhitespace = true };
            webConfig.Load( application.WebConfigFilePath );

            replaceSection( sections, webConfig, "appSettings" );
            replaceSection( sections, webConfig, "system.web" );
            replaceSection( sections, webConfig, "system.webServer" );

            try {
                webConfig.Save( application.WebConfigFilePath );
            }
            catch( Exception e ) {
                const string message = "Failed to write web configuration file.";
                if( e is UnauthorizedAccessException )
                    throw new UserCorrectableException( message, e );
                throw new ApplicationException( message, e );
            }
        }
 internal static void Init()
 {
     AppConfiguration = ConfigurationStatics.InstallationConfiguration.WebApplications.Single( a => a.Name == ConfigurationStatics.AppName );
 }