Skip to content

Add support for MSBuildTask for VS2026#1583

Closed
Kielek wants to merge 4 commits into
nuke-build:developfrom
Kielek:msbuild-vs2026
Closed

Add support for MSBuildTask for VS2026#1583
Kielek wants to merge 4 commits into
nuke-build:developfrom
Kielek:msbuild-vs2026

Conversation

@Kielek

@Kielek Kielek commented Dec 11, 2025

Copy link
Copy Markdown
Contributor

Fixes #1566

Add support for MSBuildTask for VS2026.

Now, there is no possibility to use 2026 without manually setting paths.

While reviewing, consider checking commit by commit. It brings explanations for the particular steps.

Needed for https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation

I confirm that the pull-request:

  • Follows the contribution guidelines
  • Is based on my own work
  • Is in compliance with my employer

…tion

It keeps old behavior for BuildTools
All new versions (2022+) for other editions will be taken from x64 folder.
…nstead of the year.

It might required adjustments when new versions of VS will be released
@Kielek Kielek changed the title Add support for MSBuildTask for VS2026. Add support for MSBuildTask for VS2026 Dec 11, 2025
@Kielek

Kielek commented Dec 11, 2025

Copy link
Copy Markdown
Contributor Author

quodana-scan is failing, due to following error:

2025/12/11 11:08:37 Starting from version 2023.2 release versions of Qodana Linters require connection to Qodana Cloud. 
To continue using Qodana, please ensure you have an access token and provide the token as the QODANA_TOKEN environment variable.
Obtain your token by registering at https://qodana.cloud/
For more details, please visit: https://www.jetbrains.com/help/qodana/cloud-quickstart.html
We also offer Community versions as an alternative. You can find them here: https://www.jetbrains.com/help/qodana/linters.html
✗  Qodana exited with code 1

@Kielek
Kielek marked this pull request as ready for review December 12, 2025 09:27
@zvirja

zvirja commented Apr 1, 2026

Copy link
Copy Markdown

@matkoch Could we please merge this in? It's quite crucial for VS 2026 & C# 10 support

@Kielek

Kielek commented Apr 8, 2026

Copy link
Copy Markdown
Contributor Author

Workaround.
You can call similar in your codebase:

            static void SupportVs2026IfAvailable()
            {
                // Typical installation folder: C:\Program Files\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin\amd64
                // Waiting for official support in Nuke package https://github.com/nuke-build/nuke/pull/1583

                string[] editions = ["Enterprise", "Professional", "Community", "Preview"];

                foreach (var edition in editions)
                {
                    var msBuildPath = Path.Combine(SpecialFolder(SpecialFolders.ProgramFiles).NotNull(),
                        $@"Microsoft Visual Studio\18\{edition}\MSBuild\Current\Bin\amd64\MSBuild.exe");

                    if (File.Exists(msBuildPath))
                    {
                        MSBuildPath = msBuildPath;
                        return;
                    }
                }
            }

Works fine for OTel .NET Auto, couple last months: open-telemetry/opentelemetry-dotnet-instrumentation#4706

@ricaun

ricaun commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

I don't think this gonna be merge, nuke project is dead 🥲

I did copy the Tool in the Repo to use that in my project, just change the namespace and good to go.

@Kielek

Kielek commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

Closing. I doubt it will be ever merged. If needed, feel free to reopen in the future.

@Kielek Kielek closed this Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Could not find a suitable MSBuild instance - VS 2026

3 participants