[英]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 expected
的A 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.