search
LoginSignup
7
Help us understand the problem. What are the problem?

More than 1 year has passed since last update.

posted at

updated at

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

エラー文

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,
    }
};

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
What you can do with signing up
7
Help us understand the problem. What are the problem?