Skip to content

What is the build process for building extensions from source? #83065

@AddioElectronics

Description

@AddioElectronics

Hey there,

Goto Original Post

Goto First Edit

Ok I'm fairly sure that I definitely figured it out.

Just have 2 questions.

Building RoslynDeployment produces many different VSIX files, but only packages 4 of them.

  1. What are all the other VSIXs for?
  2. Does RoslynDeployment contain everything that would be in an official release? (Other than public API libs)

Build Steps Summarized

Just incase someone else has made their own modifications, and is no longer able to build after pulling from main, here is what I did.

Show Build Steps
  1. First off, don't pull from main like I did, pull from one of the recent VS release branches.
    But if you do, just make sure to grab these files from a release branch.
    This will guarantee you're targeting the proper runtime for VS.
    • globals.json
    • eng\targets\TargetFrameworks.props
  2. Run these commands to build Microsoft.CodeAnalysis projects into nuget packages
    • restore.cmd
    • dotnet restore
    • `build.cmd -restore -pack
  3. Add your package directory to NuGet.config, could be where they built to artifacts\packages\Debug\Shipping
  4. Set <MicrosoftCodeAnalysisVersionFromSbrp> inside eng\version.props to the version of your packages.
  5. Restore again to reference your nuget packages.
    • restore.cmd /p:DotNetBuildSourceOnly=true
    • dotnet restore
  6. In VS, either Build or Deploy RoslynDeployment
VSIX Output
│   ExpressionEvaluatorPackage.vsix
│   Microsoft.CodeAnalysis.Analyzers.Setup.vsix
│   Microsoft.CodeAnalysis.BannedApiAnalyzers.Setup.vsix
│   Microsoft.CodeAnalysis.ExpressionEvaluator.json
│   Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers.Setup.vsix
│   Microsoft.CodeAnalysis.PublicApiAnalyzers.Setup.vsix
│   Microsoft.CodeAnalysis.VisualStudio.Setup.json
│   Microsoft.VisualStudio.IntegrationTest.Setup.vsix
│   Microsoft.VisualStudio.IntegrationTestService.vsix
│   Roslyn.Compilers.Extension.vsix
│   Roslyn.Diagnostics.Analyzers.Setup.vsix
│   Roslyn.VisualStudio.DiagnosticsWindow.vsix
│   Roslyn.VisualStudio.ServiceHub.Setup.arm64.vsix
│   Roslyn.VisualStudio.ServiceHub.Setup.x64.vsix
│   Roslyn.VisualStudio.Setup.Dependencies.vsix
│   Roslyn.VisualStudio.Setup.vsix
│   RoslynDeployment.vsix
│   Text.Analyzers.Setup.vsix
│
├───DevDivPackages
│       DependentAssemblyVersions.csv
│
└───Insertion
    │   ExpressionEvaluatorPackage.vsix
    │   Microsoft.CodeAnalysis.Compilers.arm64.json
    │   Microsoft.CodeAnalysis.Compilers.arm64.vsix
    │   Microsoft.CodeAnalysis.Compilers.x64.json
    │   Microsoft.CodeAnalysis.Compilers.x64.vsix
    │   Microsoft.CodeAnalysis.Compilers.x86.json
    │   Microsoft.CodeAnalysis.Compilers.x86.vsix
    │   Microsoft.CodeAnalysis.ExpressionEvaluator.json
    │   Microsoft.CodeAnalysis.VisualStudio.Setup.json
    │   Roslyn.VisualStudio.Setup.vsix
    │
    └───OptProf
            ProfilingInputs.props

First Edit

Show Edit

I think I figured it out, I got it building again, I'm just not sure if what I did was hacky, or more inline with how an official release would do it.
The compiler works, services crash, but I should have it from here, I remember having to fix broken services before.

Edit: All my service errors are happening because they can't find the .NET 10 DLLs.

For some reason DevHub/Services are looking for them in `C:\Program Files\Microsoft Visual Studio\18\Community\Common7\IDE\CommonExtensions\Microsoft\Editor\ServiceHub\dotnet\x64`, instead of getting them from the dotnet runtime install.

I noticed that VS 2026 comes packaged with 10.0.104, so I'm thinking that maybe if I targeted that version instead it would use them? But the 104 installer just says success, probably because it detects 105 is installed, so I decided to come back to this if I don't find another solution.

I also noticed that Visual Studio seems to be using .NET 8 DLLs, so I've decided I'm going to try targeting .NET 8 first.

I'd really appreciate any tips on how to fix this. I don't need a lot of help, just a push in the right direction.

My build steps

  1. Built and packed all Microsoft.CodeAnalysis packages
    1. restore.cmd
    2. dotnet restore
    3. build.cmd -restore -pack /p:DotNetBuildSourceOnly=true (Might have used -publish too)
  2. Added the directory containing the packages as a source to Nuget.Config
  3. Modified <MicrosoftCodeAnalysisVersionFromSbrp> in Version.props to use my version.
  4. Ran restore.cmd
  5. Built VSIX's via RoslynDeployment, and others not referenced by it.
  6. Installed RoslynDeployment.vsix

Questions

If any one has time I still have some questions, please and thanks.

  1. Do I have all the VSIX for a full install, and what order do they need to be installed in?

    I noticed that build.ps1 expects 7 VSIX files, and building RoslynDeployment only provides 5 of them.

  2. Do I even need the other VSIX that are packed into RoslynDeployment.vsix? What do they even do?

    When I install more than just RoslynDeployment.vsix, even more stuff starts breaking, and wondering if I shouldn't waste my time fixing it?

    1. Roslyn.VisualStudio.DiagnosticsWindow
    2. Microsoft.VisualStudio.IntegrationTest.Setup
  3. Since I built from source with new nuget packages, am I going to need to somehow load the assemblies that aren't covered by RoslynDevelopment.vsix?
  4. And I guess I should probably ask, am I building it properly, or did I do something hacky? I can't remember if I was building from source before, its possible that my old version never modified the public API, so never had to.
  5. Is deployment via build.ps1 deprecated? > I see the function that does the install, but using -deployExtensions -launch only starts the hive without any extensions installed.

VSIX Output

Artifacts/VSSetup/Debug
│   ExpressionEvaluatorPackage.vsix
│   Microsoft.CodeAnalysis.ExpressionEvaluator.json
│   Microsoft.CodeAnalysis.VisualStudio.Setup.json
│   Microsoft.VisualStudio.IntegrationTest.Setup.vsix
│   Roslyn.Compilers.Extension.vsix
│   Roslyn.VisualStudio.DiagnosticsWindow.vsix
│   Roslyn.VisualStudio.ServiceHub.Setup.x64.vsix
│   Roslyn.VisualStudio.Setup.Dependencies.vsix
│   Roslyn.VisualStudio.Setup.vsix
│   RoslynDeployment.vsix
│
└───Insertion
        ExpressionEvaluatorPackage.vsix
        Microsoft.CodeAnalysis.ExpressionEvaluator.json
        Microsoft.CodeAnalysis.VisualStudio.Setup.json
        Roslyn.VisualStudio.Setup.vsix

Original Post

Show Original

Yesterday I pulled main and merged it with a branch from back in 2024, and I was up all last night trying to get it to perform a deployment build from source only.
I just can't figure out how to either get it to build from source in VS, or get command line to build VSIXs.
Most of them build fine with packages.

Has the build process changed at all since 2024, because I see that the docs still says to use VS 2022 preview, and before the merge it was pretty much 1 command and you were fully deployed in a experimental instance.
I'm worried it still is and that something broke from the merge.

I did manage to get it partially built, but any projects that access my custom symbols/members won't build because VS is using nuget packages.
All the compiler projects build just fine, all my unit tests pass, but its the others I'm having trouble with.

So I guess these are my main questions.

  1. Should I be using VS 2022, or is 2026 ok? VS 2022 can't even build for .NET 10 correct?
    2 What is the proper steps to deploying these days? Using command line or in VS (and how to build from source in VS)? I'm assuming using restore is supposed to bootstrap the build, and next time you build in VS it uses the bootstrap, but that is just a guess.
  2. What is the full list of VSIX and what order do they need to be installed in?
  3. Do nuget packages need to be installed as well?
  4. When building fully from source do you also need to install nuget packages for VSIXs to reference as well?
    I ask this because before the merge I had it installed, and a bunch of services were failing due to missing files or assemblies.

Here is a summary of everything I tried

First I started with command lines, which is what I used before minus the DotNetBuildSourceOnly.

  1. restore.cmd
  2. build.cmd -restore -configuration Debug -deployExtensions /p:DotNetBuildSourceOnly=true

I've also tried adding -pack, -publish, /p:DeployExtension=true .

Was building extensions removed from build.ps1?
It seems to build without errors, but its just not building all the projects, and doesn't produce any VSIX files.

Attempting to build the RoslynDeployment project inside of visual studio only produces 1 or 2 extensions, before producing thousands of errors. I tried setting DotNetBuildSourceOnly in a props file, but it just causes even more really weird errors.

Building the full solution almost produces all the extensions, but still fails with 1904 errors.
Its always missing either Roslyn.VisualStudio.Setup and RoslynDeployment , or Roslyn.VisualStudio.DiagnosticsWindow and Microsoft.VisualStudio.IntegrationTest.Setup.

I should probably note that I have tried deleting the artifacts folder, and it temporarily changed which VSIXs were missing.

These are all the files in the artifacts\VSSetup folder that I was able to produce when building the solution (after deleting artifacts folder).
As far as I know I'm just missing Roslyn.VisualStudio.Setup.vsix which is also causing RoslynDeployment.vsix to not build. My last attempt I now have both of those files, but am now missing Roslyn.VisualStudio.DiagnosticsWindow and Microsoft.VisualStudio.IntegrationTest.Setup instead.

VSSetup\Debug
│   ExpressionEvaluatorPackage.vsix
│   Microsoft.CodeAnalysis.Analyzers.Setup.vsix
│   Microsoft.CodeAnalysis.ExpressionEvaluator.json
│   Microsoft.VisualStudio.IntegrationTestService.vsix
│   Roslyn.Compilers.Extension.vsix
│   Roslyn.Diagnostics.Analyzers.Setup.vsix
│   Roslyn.VisualStudio.DiagnosticsWindow.vsix
│   Roslyn.VisualStudio.ServiceHub.Setup.arm64.vsix
│   Roslyn.VisualStudio.ServiceHub.Setup.x64.vsix
│   Roslyn.VisualStudio.Setup.Dependencies.vsix
│
├───DevDivPackages
│       DependentAssemblyVersions.csv
│
└───Insertion
        ExpressionEvaluatorPackage.vsix
        Microsoft.CodeAnalysis.Compilers.arm64.json
        Microsoft.CodeAnalysis.Compilers.arm64.vsix
        Microsoft.CodeAnalysis.Compilers.x64.json
        Microsoft.CodeAnalysis.Compilers.x64.vsix
        Microsoft.CodeAnalysis.Compilers.x86.json
        Microsoft.CodeAnalysis.Compilers.x86.vsix
        Microsoft.CodeAnalysis.ExpressionEvaluator.json

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions