{"record":{"id":"d98c2efb3c056cbb","repo":"stride3d/stride","slug":"this-option-is-only-available-on-windows","errorCode":null,"errorMessage":"This option is only available on Windows","messagePattern":"This option is only available on Windows","errorType":"validation","errorClass":"OptionException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.Tasks/Program.cs","lineNumber":84,"sourceCode":"            try\n            {\n                var commandArgs = p.Parse(args);\n                if (showHelp)\n                {\n                    p.WriteOptionDescriptions(Console.Out);\n                    return 0;\n                }\n\n                // Make sure path exists\n                if (commandArgs.Count == 0)\n                    throw new OptionException(\"You need to specify a command\", \"\");\n\n                switch (commandArgs[0])\n                {\n                    case \"locate-devenv\":\n                    {\n                        if(!OperatingSystem.IsWindows())\n                            throw new OptionException(\"This option is only available on Windows\", \"\");\n                            \n                        if (commandArgs.Count != 2)\n                            throw new OptionException(\"Need one extra argument\", \"\");\n                        var devenvPath = LocateDevenv.FindDevenv(commandArgs[1]);\n                        if (devenvPath == null)\n                        {\n                            Console.WriteLine(\"Could not locate devenv\");\n                            return 1;\n                        }\n                        Console.WriteLine(devenvPath);\n                        break;\n                    }\n                    case \"pack-assets\":\n                    {\n                        if (commandArgs.Count != 3)\n                            throw new OptionException(\"Need two extra arguments\", \"\");\n\n                        var csprojFile = commandArgs[1];","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.Tasks/Program.cs#L66-L102","documentation":"The locate-devenv command uses Windows-only Visual Studio discovery APIs (LocateDevenv.FindDevenv). RealMain explicitly checks OperatingSystem.IsWindows() and throws this OptionException when the command is used on any other OS.","triggerScenarios":"Running 'Stride.Core.Tasks locate-devenv <version>' on Linux or macOS.","commonSituations":"Porting a Windows build script to a Linux CI agent; running the tool in a cross-platform Docker image; trying to locate Visual Studio from WSL without Windows context.","solutions":["Run this command on Windows only.","On non-Windows, use the platform's build tool directly (e.g. dotnet msbuild) instead of locating devenv.","Wrap the call in an OS check in your script and skip or substitute an alternative."],"exampleFix":"// before\nStride.Core.Tasks locate-devenv 17\n// after (script guard)\nif [[ \"$OSTYPE\" == msys* || \"$OSTYPE\" == cygwin* ]]; then Stride.Core.Tasks locate-devenv 17; else dotnet msbuild MyGame.sln; fi","handlingStrategy":"fallback","validationCode":"if (!OperatingSystem.IsWindows())\n{\n    Console.WriteLine(\"locate-devenv requires Windows; using dotnet msbuild fallback\");\n    return RunFallbackBuild();\n}","typeGuard":null,"tryCatchPattern":"try { LocateDevenvFlow(); }\ncatch (OptionException ex) when (ex.Message.Contains(\"Windows\")) { UseCrossPlatformBuild(); }","preventionTips":["Gate Windows-only commands behind OperatingSystem.IsWindows()","Provide cross-platform build fallbacks in CI","Document OS requirements in the script header"],"tags":["cli","platform","windows-only"],"backgroundTag":"unsupported-platform","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}