开发者

Visual Studio 2008 using the wrong framework version

开发者 https://www.devze.com 2022-12-30 19:41 出处:网络
Using Visual Studio 2008, and I\'m trying to use some of the .net Framework 3.5 utilities - specifically Extension Methods.

Using Visual Studio 2008, and I'm trying to use some of the .net Framework 3.5 utilities - specifically Extension Methods.

However when I try and get to things in the System.Runtime.CompilerServices namespace, the required .Extension namespace is unavailable.

If I go to "add reference" and look for System.Core - the required l开发者_开发问答ibrary for this functionality - it's in the list but is greyed out and unavailable, as are all the other 3.5 libraries.

I have the 3.5 framework installed on my machine. Indeed many of the libraries are being loaded through web.config. Anyone know what's going on here and how I can fix it?


You need to set the project to the correct target framework version (in the project properties).

Note that compiler features (such as declaring and using extension functions) is not dependent on the selected framework version, since those are independent of the CLR version (framework versions 2.0-3.5 uses the same runtime).


  • Right-click on your web application (and all other projects)
  • Goto the compile tab.
  • Click on advanced compile options
  • Set the target framework to ".NET Framework 3.5"
0

精彩评论

暂无评论...
验证码 换一张
取 消