Guide for updating the Roslyn language server version in the vscode-csharp repository. Use this when asked to update Roslyn, bump the Roslyn version, or upgrade the language server version.
This skill describes how to update the Roslyn language server version in the vscode-csharp repository.
dotnet/roslyn repository (commonly at C:\Users\<username>\source\repos\roslyn)roslyn-tools CLI tool must be installed as a global .NET tool:
dotnet tool install -g Microsoft.RoslynTools --prerelease --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json
Note: After installation, the tool is invoked as roslyn-tools (not dotnet roslyn-tools)roslyn-tools:
roslyn-tools authenticate
5.5.0-2.26080.10). If not provided, the version will be auto-discovered from the latest passing dotnet-roslyn-official pipeline build on main. See Version Auto-Discovery below.If the user does not provide a specific Roslyn version, follow these steps to discover the latest version from the official Roslyn build pipeline.
azd) must be installed. See https://learn.microsoft.com/azure/developer/azure-developer-cli/install-azd for platform-specific instructions.azd auth login
Get an Azure DevOps bearer token:
TOKEN=$(azd auth token --scope "499b84ac-1321-427f-aa17-267ca6975798/.default" --output json | jq -r '.token')
Find the latest passing main build (pipeline definition ID 327 = dotnet-roslyn-official):
BUILD_ID=$(curl -s -H "Authorization: Bearer $TOKEN" \
"https://dnceng.visualstudio.com/internal/_apis/build/builds?definitions=327&branchName=refs/heads/main&statusFilter=completed&resultFilter=succeeded&\$top=1&api-version=7.0" \
| jq '.value[0].id')
Find the "Publish Assets" task log URL from the build timeline:
LOG_URL=$(curl -s -H "Authorization: Bearer $TOKEN" \
"https://dnceng.visualstudio.com/internal/_apis/build/builds/$BUILD_ID/timeline?api-version=7.0" \
| jq -r '.records[] | select(.name == "Publish Assets" and .type == "Task") | .log.url')
Fetch the log and extract the NuGet package version:
VERSION=$(curl -s -H "Authorization: Bearer $TOKEN" "$LOG_URL" \
| grep -oP 'Microsoft\.CodeAnalysis\.\K\d+\.\d+\.\d+-[\w.]+(?=\.nupkg)' \
| head -1)
echo "Discovered version: $VERSION"
The extracted version (e.g., 5.6.0-2.26173.1) is the value to use as the new Roslyn version for the rest of the process.
Create a new git branch for the update:
git checkout -B update/roslyn-<version>
Replace <version> with the new Roslyn version, using dashes instead of dots for the branch name.
Update the defaults.roslyn field in package.json:
"defaults": {
"roslyn": "<new-version>",
...
}
This step acquires the new Roslyn packages and ensures they are in the proper feeds:
npm run updateRoslynVersion
This task:
installDependencies to update local dependenciesNote: You may need to install the Azure Artifacts NuGet Credential Provider for interactive authentication.
The commit SHAs are stored in the .nuspec files inside the downloaded NuGet packages. After running npm run updateRoslynVersion, the new version's package will be cached locally, but you need to explicitly download the old version to get its commit SHA.
To get the old version's commit SHA:
package.json (before your edit) - look at the defaults.roslyn valuedotnet restore "C:\Users\<username>\source\repos\vscode-csharp\msbuild\server" /p:PackageName=roslyn-language-server.osx-arm64 /p:PackageVersion=<old-version> --interactive
Get-Content "C:\Users\<username>\source\repos\vscode-csharp\out\.nuget\roslyn-language-server.osx-arm64\<old-version>\roslyn-language-server.osx-arm64.nuspec" | Select-String -Pattern "commit"
This will show output like:
<repository type="git" url="https://github.com/dotnet/roslyn" branch="main" commit="0e21a3cb684db6ab02646541a780b3278f53d19e" />
After running npm run updateRoslynVersion, the new version's package is already cached. Extract the commit SHA:
Get-Content "C:\Users\<username>\source\repos\vscode-csharp\out\.nuget\roslyn-language-server.osx-arm64\<new-version>\roslyn-language-server.osx-arm64.nuspec" | Select-String -Pattern "commit"
Note: The Azure DevOps artifacts feed web pages require authentication and may not load properly in automated scenarios. Always use the nuspec files from the local package cache.
First, locate the local dotnet/roslyn repository. Common locations include:
C:\Users\<username>\source\repos\roslynC:\repos\roslynNavigate to the roslyn repository, fetch the latest, and run the pr-finder tool:
cd <path-to-roslyn-repo>
git fetch origin
roslyn-tools pr-finder --start <old-commit-sha> --end <new-commit-sha> --format "o#"
Important: The tool is invoked as roslyn-tools (a global tool), NOT dotnet roslyn-tools.
This will output a list of PRs in the format needed for the changelog:
* <PR title> (PR: [#<number>](https://github.com/dotnet/roslyn/pull/<number>))
Add an entry to CHANGELOG.md under the current version section (e.g., # 2.121.x):
Copy the results from the previous step (should already be formatted correctly).
* Update Roslyn to <new-version> (PR: [#](https://github.com/dotnet/vscode-csharp/pull/))
* <PR title 1> (PR: [#<number>](https://github.com/dotnet/roslyn/pull/<number>))
* <PR title 2> (PR: [#<number>](https://github.com/dotnet/roslyn/pull/<number>))
...
Note: Leave the PR number blank initially (just [#]) - it will be updated after the PR is created.
Review the changelog entries and remove any PRs that obviously don't affect VS Code. Remove entries that are:
Keep entries that are:
git add package.json CHANGELOG.md
git commit -m "Update Roslyn to <new-version>"
git push -u origin update/roslyn-<version>
Create a pull request on GitHub:
Update roslyn to <new-version>mainAfter the PR is created, note the PR number (e.g., #8941), then:
Update the CHANGELOG.md entry to include the actual PR number:
* Update Roslyn to <new-version> (PR: [#8941](https://github.com/dotnet/vscode-csharp/pull/8941))
Commit and push the update:
git add CHANGELOG.md
git commit -m "Update changelog with PR number"
git push
For updating from 5.4.0-2.26077.7 to 5.5.0-2.26080.10:
update/roslyn-5-5-0-2-26080-10"roslyn": "5.5.0-2.26080.10"5.4.0-2.26077.75.5.0-2.26080.10npm run updateRoslynVersionSee PR #8941 as an example of a Roslyn version update.
package.json - Update defaults.roslyn versionCHANGELOG.md - Add changelog entry with Roslyn PR listIf you encounter authentication errors:
Ensure:
git fetch originroslyn-tools authenticateroslyn-tools pr-finder (not dotnet roslyn-tools)The commit SHAs are embedded in the nuspec files inside the downloaded NuGet packages:
npm run updateRoslynVersion, packages are cached in out/.nuget/dotnet restore "msbuild\server" /p:PackageName=roslyn-language-server.osx-arm64 /p:PackageVersion=<old-version> --interactive
Get-Content "out\.nuget\roslyn-language-server.osx-arm64\<version>\roslyn-language-server.osx-arm64.nuspec" | Select-String -Pattern "commit"
Note: The Azure DevOps artifacts feed web pages require authentication and often fail to load in automated scenarios. Always use the local nuspec files instead.