I came across an issue that makes me think there is bug in the 3.0 framework. When I try to use extension methods I get the following error:
Missing compile
This problem is indeed caused by an incorrect reference to version 2 of System.Core . This is normally caused when upgrading from an earlier version of .NET to .NET 3.5 . If it is a website that you are experiencing this problem in then it can be remedied by following the steps below:
1) In web.config add a reference to System.Core v3.5:
<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
2) In web.config add the following as a child of configuration:
<configuration>
<!--Some other config-->
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Core" publicKeyToken="B77A5C561934E089"/>
<bindingRedirect oldVersion="2.0.0.0-2.1.0.0" newVersion="3.5.0.0"/>
</dependentAssembly>
</assemblyBinding>
</configuration>
Edit your csproj and make sure those references are included (it wont work by simple 'add reference'...):
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
A missing System.Core reference will give these symptoms.
Is this a web site project, by chance? Try changing the target framework from .NET 3.5 to an earlier version, and then back to .NET 3.5.
in VS, click Project (next to File,Edit,View), select Properties
then in Application tab (you'll notice you're already in 3.5), select the Target Framework to 2.0, then compile (it will error). then put it back again to 3.5, then compile again, the error will disappear
i think it is just a small glitch in Visual Studio, just fool the IDE :-)
Your framework isn't high enough for Extension Methods.
That's a hack for making extension methods work without being in 3.5