4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Visual Studio で作られたテストプロジェクトを Express 版でビルドできるようにする

Posted at

Visual C# 2008 Express での話ですが、きっと他のバージョンでも動くはず。なぜ Express かは聞かないでください。

まず、テストプロジェクトでは MbUnit + Gallio などを利用していて、Visual Studio Unit Testing Framework は使用していないことが前提です。

Project Type Guid の変更

Express 版ではテストプロジェクトを開くことができません。まず .csproj をいじってテストプロジェクトでなくします。

    <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

という行があるはず。guid が 2 つありますが、前者が Test で後者が Windows (C#) です。
参考: .net - What is the significance of ProjectTypeGuids tag in the visual studio project file | Stackoverflow

Visual Studio からテストを実行しないので、Test プロジェクトである必要はありません。以下のように Test の guid を削除します。

    <ProjectTypeGuids>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

これで Express でも開けるようになるはず。

Visual Studio Unit Testing Framework の参照の削除

Visual Studio Unit Testing Framework の DLL は、Express 版だとインストールされません。ですので、参照しているとプロジェクトがビルドできません。どうせ使わないので以下の参照を削除します。

    <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />

これで Express 版でもビルドできるようになるはず。

Icarus Test Runner

Visual Studio でビルドした DLL を Project に追加します。これで実行可能。

ビルドし直しても DLL を読み込み直してくれるので安心です。

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?