我发现这个问题在我的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找不到
发布评论