I am trying to publish a ASP.Net 3.5 site to an IIS 7.5 server using WebDAV and each time I do the config file winds up empty. The culprit is the providerOption elemet seen in the code below.
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="OptionInfer" value="true"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
</compilers>
The FX_schema.xml file at C:\Windows\System32\inetsrv\config\schema is being used to validate the Web.config for the site and it doesn't contain providerOptions as part of the XML there. I could add something to allow for that modify the file to allow for it by adding something like this:
<collection addElement = "providerOption">
<attribute name = "name" required = "true" isUniqueKey = "true" type = "string" />
<attribute name = "value" required = "true" type = "string" />
</collection>
But I don't have any permissions to write to the schema file. This also looks like something others should be seeing and a quick search found some people are. The only option I have seen is "Just delete the codedom section" which means 3.5 things, like LINQ, will not work so that is a non-starter.
So how do I publish my Web Site to IIS 7.5 with the providerOption elements intact?
Well, since I couldn't find anything specific I just went ahead and did what I thought might be the solution: I made my own file and placed it in with the schema files. I called it the inventive name ThreeFive.xml and placed it at C:\Windows\System32\inetsrv\config\schema. The entire contents of the file are as follows:
I then published a 3.5 site that retrieved information from an appconfig setting and did some LINQ to make sure the config and the 3.5 were in effect. The config file was not blanked and the LINQ is working as expected so I am tempted to call this a solution.