コード例 #1
0
        public override void _EnablePlugin()
        {
            base._EnablePlugin();

            if (Instance != null)
            {
                throw new InvalidOperationException();
            }
            Instance = this;

            var dotNetSdkSearchVersion = Environment.Version;

            // First we try to find the .NET Sdk ourselves to make sure we get the
            // correct version first (`RegisterDefaults` always picks the latest).
            if (DotNetFinder.TryFindDotNetSdk(dotNetSdkSearchVersion, out var sdkVersion, out string sdkPath))
            {
                if (Godot.OS.IsStdoutVerbose())
                {
                    Console.WriteLine($"Found .NET Sdk version '{sdkVersion}': {sdkPath}");
                }

                ProjectUtils.MSBuildLocatorRegisterMSBuildPath(sdkPath);
            }