LoginSignup
13
7

More than 3 years have passed since last update.

Unity 2020で出てくるError detecting Visual Studio installations~への対処法

Last updated at Posted at 2020-07-30

エラー文

Error detecting Visual Studio installations: System.ArgumentException: JSON parse error: Invalid escape character in string.

原因

Visual Studio Editorパッケージが使用しているvswhere.exeから出力されるJsonに
一部Shift_JIS文字列が含まれるためパースでエラーが起きてるらしい

対処法

Packages/com.unity.ide.visualstudio/Editor/Discovery.csのProcessインスタンス生成部分を修正して強制的にUTF-8にする

Discovery.cs

var process = new Process
{
    StartInfo = new ProcessStartInfo
    {
        FileName = progpath,
        //-utf8オプションで強制的にUTF-8として出力
        //Arguments = "-prerelease -format json",
        Arguments = "-prerelease -format json -utf8",
        UseShellExecute = false,
        CreateNoWindow = true,
        RedirectStandardOutput = true,
        RedirectStandardError = true,
    }
};

13
7
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
13
7