Error CS0501 and SharePoint

Last week when deploying some SharePoint solutions, I got error CS0501 thrown on my plate:
sp-error

ULS told me nothing more:

System.Web.HttpCompileException: c:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\ep\EPErrorPage.aspx(16): error CS0501: ‘ASP._layouts_ep_eperrorpage_aspx.UseDefaultResourceValue.get’ must declare a body because it is not marked abstract or extern

I was deploying to a SharePoint site that happens to be a Microsoft Dynamics AX 2012 Enterprise Portal as well (only web parts deployed). As it turns out, it probably has nothing to do with AX, but just wanted to get that specific error out there.

So first, I thought it was AX and turned custom errors off (as maybe this custom error page was broken). Same error.
Next up, surfing the net for error CS0501. I already suspected it being a framework or compiler limitation and already checked the application pools being v2.0, and looked in the web.config for the compiler and found the compiler version to be correct:

<providerOption name="CompilerVersion" value="v3.5" />

Then, I double checked the compiler section, finding only 1 entry for Visual Basic and the like and nothing for C#! No wonder my C# code in pages doesn’t compile…
Turns out the SharePoint deployment did some strange stuff removing that section as it had always been there…
But where was the basic v1 compiler configured? Checking machine.config left only mysteries. No <compilers> section…
So I don’t know what it falls back to.

Medium story short, I changed the compilers section from:

    <compilers>
      <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>

to:

    <compilers>
      <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>
      <compiler extension=".cs" language="c#;cs;csharp" 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>
    </compilers>

and it worked fine again.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s