如何解决此错误:找不到文件“Microsoft.Windows.CommonLanguageRuntime,版本 2.0.50727.0”
我已经找到答案的这个问题发布在这里,以防其他人遇到它。我决定在这里发布问答,以便 SO 了解有关此错误的信息,因为我不知道以前是否曾出现过此错误。
这是在 .NET Framework 更新后发生的。更新之前,一切都编译得很好!更新后,我什么也编译不了!
错误信息是:
错误 1 - 找不到文件“Microsoft.Windows.CommonLanguageRuntime,Version=2.0.50727.0”。
This question to which I already found the answer is posted here in case of someone else encounters it. I decided to post the Q&A here so that SO has something about this error, since I don't know if it's been here before.
This occured after an update of the .NET Framework. Before the update, everything compiled just fine! After the update, I could compile nothing!
The error message is:
Error 1 - Could not find file 'Microsoft.Windows.CommonLanguageRuntime, Version=2.0.50727.0'.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是 Visual Studio 2005 中的一个问题。这是在 .NET Framework 2.0 更新后发生的,是由于单个解决方案中的项目引用造成的。
例如,当您编写一个测试库来在同一解决方案中测试您的程序集时,您很可能会引用该项目。那么,可能会出现这个错误。
要解决此错误,只需引用项目的二进制文件,其中包含要测试的代码的 DLL 或 EXE。这称为文件引用。
假设我们有两个名为:
Company.Project.ApplicationName.Tests
。在
Company.Project.Application.Tests
项目中添加对Company.Project.ApplicationName
项目的引用时,我们可以使用浏览或项目选项卡。使用项目选项卡时,您可以创建项目引用。如果发生此错误,我们不想使用它。我们想要使用的是浏览,这样我们就可以进行文件引用。以下是解释此问题的 Microsoft 支持网站的链接。
当您构建Visual Studio 2005 中的 Visual Basic 2005 Windows 应用程序项目的解决方案
This is a problem within Visual Studio 2005. This occurs after an update of the .NET Framework 2.0 and is due to project reference within a single solution.
For example, when you're writing a test library which will test your assembly within the same solution, you will most likely reference the project. Then, this error may occur.
To solve this error, simply reference the file binary of your project, either the DLL or the EXE within which resides the code you want to test. This is called a file reference.
Let's suppose we have two projects called:
Company.Project.ApplicationName
;Company.Project.ApplicationName.Tests
.When adding the reference to our
Company.Project.ApplicationName
project within ourCompany.Project.Application.Tests
project, we can either use the Browse or the Project tab. When using the Project tab, you create a project reference. We don't want to use this if this error occurs. What we want to use is Browse, so that we can make a file reference.Here's a link to the Microsoft Support Website that explains this issue.
You may receive a "Could not find file 'Microsoft.Windows.CommonLanguageRuntime" error message when you build a solution of a Visual Basic 2005 Windows Application project in Visual Studio 2005