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'.

4

1 に答える 1

1

これは、Visual Studio 2005内の問題です。これは、.NET Framework 2.0の更新後に発生し、単一のソリューション内のプロジェクト参照が原因です。

たとえば、同じソリューション内でアセンブリをテストするテストライブラリを作成する場合、ほとんどの場合、プロジェクトを参照します。その後、このエラーが発生する可能性があります。

このエラーを解決するには、プロジェクトのファイルバイナリ(テストするコードが含まれているDLLまたはEXE)を参照するだけです。これはファイル参照と呼ばれます。

次の2つのプロジェクトがあるとします。

  1. Company.Project.ApplicationName;
  2. Company.Project.ApplicationName.Tests

Company.Project.ApplicationNameプロジェクト内にプロジェクトへの参照を追加するときは、 [参照]または[プロジェクトCompany.Project.Application.Tests]タブのいずれかを使用できます。[プロジェクト]タブを使用する場合は、プロジェクト参照を作成します。このエラーが発生した場合、これは使用しません。使用したいのはブラウズです。これにより、ファイル参照を作成できます。

この問題を説明するMicrosoftサポートWebサイトへのリンクは次のとおりです。

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

于 2010-10-04T18:46:53.377 に答える