2017-06-24 10 views
18

私はRoslynにいくつかの変更を加えて遊んでいますが、残念ながらVisualStudioSetup.Nextを実行してMSアセンブリを読み込もうとすると修正されない解決策がクラッシュします。だから私はいくつかの簡単な変更を加え、私のマシンの既存のバイナリと設定ファイルを新しいビルドに置き換えました。変更はC:/Program Files (x86)/MSBuild/bin and Windows/Microsoft.NET/Framework64で行われました。C#コンパイラを新しいRoslynビルドに置き換える

CSC、VBCSCompiler、DLL、および設定ファイルを置き換えると、いずれのビルドでもcsc.exeがエラーをスローします。マニフェストで異なるバージョンのCodeAnalysis.CSharp DLLが指定されていると不平を言います。ファイルまたは名前のパスを指定しません。私は上記のフォルダにあるconfigsとDLLの両方を新しいビルドに置き換えました。正しく動作するためには、実際にどのファイルを交換する必要がありますか?

CSCのすべてのインスタンスについてドライブ全体を検索し、すべての設定で新しいバージョンのDLLが指定されていることを確認しました。そのため、今どこを見てもわかりません。

MSBuildにパラメータを渡すこともcsprojファイルにセクションを追加してコンパイラバイナリ用のディレクトリを指定することもできますが、私はこの点で勝利したいと思います。

編集:私は自分のビルドのバージョン番号を変更することにしました。 VSのアセンブリプロパティを使用すると、ビルドが失敗します。 MSBuildを使用しようとしましたが、このエラーが発生したすべてのプロジェクトで失敗します。

"F:\Git\Repos\roslyn\src\Compilers\CSharp\csc\csc.csproj" (default target) (1) -> 

F:\Git\Repos\roslyn\build\Targets\Versions.props(42,5): 

error MSB4184: The expression ""1".Substring(3)" cannot be evaluated. 

startIndex cannot be larger than length of string. 

Parameter name: startIndex F:\Git\Repos\roslyn\src\Compilers\CSharp\csc\csc.csproj] 

VSからは問題ありません。

のMSBuildのparams:/p:OfficialBuild=true /p:BuildNumber=1.3.1.60616 /p:Configuration=Release

+3

あなたのしていることは少し汚れているようです。 –

+0

@MathiasLykkegaardLorenzenはい。私のチームはいたずらを引いて逆戻りするのが好きです。だからこそ、新しいコンパイラを使うためのビルドparamsの変更だけに熱心ではない。 –

+0

あなたが達成しようとするものは非常に興味深いですが、あなたの目標が何であるか教えてください。 Visual Studioのインストールのcsc.exeを置き換えようとしていますか? Visual Studioで更新されたcscをコンパイルすると、exeが使用されるようになりますか? –

答えて

1

Visual Studioの現在、2017年分の実験例でコンパイラを交換すること。必要なバージョンはv15.3以降です。また、Roslyn.Compilers.Extension.vsixをインストールする必要があり、VisualStudioSetup.Nextをインストールする必要はありません。次のようにDotNet Roslyn GitHubのレポのドキュメントから

正確な情報は以下のとおりです。VisualStudioSetup.Next

CompilerExtension: this project can be found inside the Compilers folder from the Solution Explorer, and builds Roslyn.Compilers.Extension.vsix . This deploys a copy of the command line compilers that are used to do actual builds in the IDE. It only affects builds triggered from the Visual Studio experimental instance it's installed into, so it won't affect your regular builds. Note that if you install just this, the IDE won't know about any language features included in your build. If you're regularly working on new language features, you may wish to consider building both the CompilerExtension and VisualStudioSetup projects to ensure the real build and live analysis are synchronized.

説明は明らかにそれはIDEのバグを修正された制限と予想される使用、だ状態:

VisualStudioSetup.Next: this project can be found inside the VisualStudio folder from the Solution Explorer, and builds Roslyn.VisualStudio.Setup.vsix. In theory, it contains code to light up features for the next version of VS (Dev16), but currently hasn't been updated for that since Dev15/VS2017 shipped. If you're working on fixing an IDE bug, this is the project you want to use.

計画している場合Visual Studio 2017のデフォルトインスタンスでRoslynコンパイラを次のように置き換えることです。

  1. Visual Studio 2017のすべてのインスタンスを終了します。
  2. Roslyn.Compilers.Extension.vsixパッケージをダブルクリックし、インストール拡張機能を昇格させた後に実行します。今回は、デフォルトのインスタンスで使用できるようにする必要があります。

上記の手順は、Visual Studioビルドツールにも適用できます。

注意 - リリースされていないコードをビルドして使用すると、インストール手順の間にバグが発生することが予想されます

関連する問題