简体   繁体   English

无法找到参考组件Microsoft.CSharp

[英]Reference Component Microsoft.CSharp could not be found

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: 我在我的Visual Studio 2010上的C#项目中发现了这个问题,当我去另一台使用2008的PC时,我打开了project.csprog:

A get or set accessor expected 期望获取或设置访问者

and warning: 和警告:

The referenced component 'Microsoft.CSharp' could not be found. 找不到引用的组件“Microsoft.CSharp”。

I think is about .NET Framework or Microsoft.CSharp is not located, because it says that: 我认为是关于.NET Framework或Microsoft.CSharp不在,因为它说:

Could not resolve this reference. 无法解析此引用。 Could not locate the assembly "Microsoft.CSharp". 无法找到程序集“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? 但我不知道这个问题,你能给我一个解决方案吗?

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. 听起来你在项目中瞄准.NET 4.0,然后尝试在VS2008中加载它,它只针对.NET 3.5。

If you need to use the project in VS2008, then you should re-target the project at .NET 3.5: 如果您需要在VS2008中使用该项目,那么您应该在.NET 3.5中重新定位该项目:

在此输入图像描述

and then remove any incorrect references (they'll probably have yellow warning triangles on them anyway). 然后删除任何不正确的引用(无论如何它们可能都有黄色警告三角形)。

The A get or set accessor expected also suggests you're using new C# syntax, for example dynamic . A get or set accessor expectedA get or set accessor expected也建议您使用新的C#语法,例如dynamic If you need to target older C# compilers, you'll have to not do that . 如果您需要定位较旧的C#编译器,则必须不这样做 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: 如果您使用的是多个IDE版本并且存在问题,那么为了确保您不会意外地执行此操作,您可以通过项目属性 - >构建 - >高级设置项目的语言版本:

在此输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法识别Microsoft.CSharp参考 - Microsoft.CSharp reference not recognized 发现无法解决的不同版本的“Microsoft.CSharp”之间的冲突 - Found conflicts between different versions of "Microsoft.CSharp" that could not be resolved 尝试导出 fastreport 报告时无法找到元数据文件“Microsoft.CSharp”错误 - Getting a Metadata file 'Microsoft.CSharp' could not be found error upon trying to export a fastreport report 主要参考“Microsoft.CSharp”是一个框架程序集,无法在当前目标框架中解析 - The primary reference “Microsoft.CSharp”, which is a framework assembly, could not be resolved in the currently targeted framework Microsoft.CSharp库中的BadImageFormat异常 - BadImageFormat Exception at Microsoft.CSharp library 使用不是管理员组成员的用户登录时无法加载文件或程序集“Microsoft.CSharp” - Could not load file or assembly 'Microsoft.CSharp' when logged in with user which is not a member of administrator group Xamarin Android 错误“无法解析引用:`System.Dynamic`,由`Microsoft.CSharp` 引用” - Xamarin Android Error "Can not resolve reference: `System.Dynamic`, referenced by `Microsoft.CSharp`" 为什么面向.Net Standard的库需要Microsoft.Csharp - Why do libraries targeting .Net Standard need Microsoft.Csharp C#Compiler-as-a-Service:Mono.CSharp与Microsoft.CSharp - C# Compiler-as-a-Service: Mono.CSharp vs Microsoft.CSharp 找不到参考组件 - Reference Component could not be found
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM