Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
359 views
in Technique[技术] by (71.8m points)

c# - Visual Studio 2010 Can no longer build .NET v3.5

I have a 2010 project that is targeting .NET v3.5. Inexplicably I can no longer build v3.5 projects. The project doesn't have ANY references added. It won't even let me add a reference to System.Core as it is added by the 'build system'.

warning CS1685: The predefined type 'System.Func' is defined in multiple assemblies in the global alias; using definition from 'c:WindowsMicrosoft.NETFrameworkv4.0.30319mscorlib.dll'

IFilter.cs(82,49): error CS0433: The type 'System.Func' exists in both 'c:Program Files (x86)Reference AssembliesMicrosoftFrameworkv3.5System.Core.dll' and 'c:WindowsMicrosoft.NETFrameworkv4.0.30319mscorlib.dll'

Looks like something is grabbing onto 4.0 but I'm not quite sure how to fix it. Any one else run into this?

Coworker had this same issue. It took a reinstall of Windows to correct the problem

I've opened a bug on this one: https://connect.microsoft.com/VisualStudio/feedback/details/558245/warning-cs1685-when-compiling-a-v3-5-net-application-in-visual-studio-2010

If the compiler is set to verbose I see this:

FrameworkPathOverride = C:WindowsMicrosoft.NETFrameworkv4.0.30319

which is defined as:

Specifies the location of mscorlib.dll and microsoft.visualbasic.dll. This parameter is equivalent to the /sdkpath switch of the vbc.exe compiler.

Some other interesting tidbits: I've created a new project all together and cannot build v3.5 at all. I can build 2.0, 3.0, 3.5 Client Profile, 4.0 and 4.0 Client Profile with no problem. VB.NET can build v3.5 but C# cannot. I've tried a reinstall of .NET 3.5, 4.0 and Visual Studio 2010 with no success. Visual Studio debug logs shown nothing interesting and Safe Mode does not work.

Trying to avoid a Windows reinstall...

EDIT: I've come to realize others are facing this issue as well. Link, Link, Link


Reinstalled several times. Visual Studio uninstalls do not clean up after themselves. I've spun up a VM to develop on until I have a chance to reinstall my main OS.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The problem was the caused by the changes made in this post. Forcing the loading of the latest CLR version is what caused the problem. Be careful!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...