5
3

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.

VS2015のC#コードをVS2013で読み込むためのTips

Posted at

Visual Studio 2015にバンドルされているC#のバージョンは6.0で、
Visual Studio 2013にバンドルされているC#のバージョンは5.0。

そのため、
VS2015で作ったコードにC# 6.0のコードが混じっているとVS2013で開いたときにビルドできない場合がある。

下記の手順を踏むことで、
(無理やり)VS2013にC# 6.0のビルドをさせるようにすることができる。

.NET Compilersをインストール

ツール > Nugetコンソールより、下記のコマンドを実行

Install-Package Microsoft.Net.Compilers -Version 1.3.2

Web.Comfigの変更

Webアプリの場合、そのままではIISのバージョンとかみ合わずにエラーになる。

langversionを6からDefault(=6)に変更することで、なんとなく通るようになる。

compilerOptions="/langversion:6 

compilerOptions="/langversion:Default

に変更

これでビルドが通るはず。

5
3
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
5
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?