参考组件Microsoft.CSharp找不到

编程入门 行业动态 更新时间:2024-10-21 20:31:26
本文介绍了参考组件Microsoft.CSharp找不到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我发现这个问题在我的C#项目,我开始在Visual Studio 2010,当我去另一台PC使用2008年,我打开project.csprog:

I found this problem on my C# project which I started at Visual Studio 2010, when I go to another PC I use 2008, I open the project.csprog:

需要获取或设置访问器

A get or set accessor expected

和警告:

找不到引用的组件Microsoft.CSharp。

The referenced component 'Microsoft.CSharp' could not be found.

是关于.NET Framework或Microsoft.CSharp不位于,因为它说:

I think is about .NET Framework or Microsoft.CSharp is not located, because it says that:

无法解析此引用。找不到程序集Microsoft.CSharp。检查以确保装配在磁盘上存在。如果您的代码需要此引用,您可能会收到编译错误

Could not resolve this reference. Could not locate the assembly "Microsoft.CSharp". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors`

,但我不知道问题,给我一个解决方案?

but I don't know the problem, can you guys give me a solution?

推荐答案

这听起来像你在项目中的目标.NET 4.0,然后尝试加载它VS2008,只能定位到.NET 3.5。

It sounds like you are targeting .NET 4.0 in the project, and then trying to load it in VS2008 which only targets up to .NET 3.5.

如果你需要在VS2008中使用这个项目,那么你应该重新定位项目在.NET 3.5上:

If you need to use the project in VS2008, then you should re-target the project at .NET 3.5:

然后删除任何不正确的引用(他们可能会在它们上面有黄色警告三角形)。

and then remove any incorrect references (they'll probably have yellow warning triangles on them anyway).

预期的获取或设置访问器也建议您使用新的C#语法,例如 dynamic 。如果您需要定位较旧的C#编译器,您必须不要这样做。如果你使用多个IDE版本,并且它是一个问题,那么为了确保你不这样做意外,你可以通过项目属性 - >生成 - >高级:

The A get or set accessor expected also suggests you're using new C# syntax, for example dynamic. If you need to target older C# compilers, you'll have to not do that. If you are using multiple IDE versions and it is being a problem, then to ensure you don't do that accidentally you can set the language version for the project via Project Properties -> Build -> Advanced:

更多推荐

参考组件Microsoft.CSharp找不到

本文发布于:2023-11-14 19:31:09,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1588333.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:找不到   组件   Microsoft   CSharp

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!