Skip to content

Commit 798007f

Browse files
Conditionally deploy Roslyn dependencies
Razor tooling deploys Roslyn dependencies to allow integration tests and VS hive debugging to function against VS preview builds. However, on local dev boxes, where VS IntPreview should be used for dogfooding, this can result in hard-to-diagnose problems when some Roslyn dependencies are loaded from the Razor tooling deployment and others are loaded from the VS install. This change only deploys Roslyn dependencies if the `IncludeRoslynDeps` MSBuild property is set to true. This is needed for running integration tests in CI, so the job has been updated to set that property.
1 parent fcae931 commit 798007f

File tree

3 files changed

+23
-13
lines changed

3 files changed

+23
-13
lines changed

azure-pipelines.yml

+1
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ stages:
210210
$(_BuildArgs)
211211
$(_PublishArgs)
212212
$(_InternalRuntimeDownloadArgs)
213+
/p:IncludeRoslynDeps=true
213214
name: Build
214215
displayName: Build and Deploy
215216
condition: succeeded()

src/Razor/src/Microsoft.VisualStudio.RazorExtension.Dependencies/AssemblyCodeBases.cs

+6-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33

44
using Microsoft.VisualStudio.Shell;
55

6+
[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\Microsoft.VisualStudio.LanguageServer.Protocol.dll")]
7+
[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\Microsoft.VisualStudio.LanguageServer.Protocol.Internal.dll")]
8+
[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\Microsoft.VisualStudio.LanguageServer.Protocol.Extensions.dll")]
9+
10+
#if INCLUDE_ROSLYN_DEPS
611
[assembly: ProvideBindingRedirection(
712
AssemblyName = "Microsoft.CodeAnalysis",
813
GenerateCodeBase = true,
@@ -95,6 +100,4 @@
95100
NewVersion = "4.5.0.0")]
96101

97102
[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\Microsoft.CodeAnalysis.Workspaces.dll")]
98-
[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\Microsoft.VisualStudio.LanguageServer.Protocol.dll")]
99-
[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\Microsoft.VisualStudio.LanguageServer.Protocol.Internal.dll")]
100-
[assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\Microsoft.VisualStudio.LanguageServer.Protocol.Extensions.dll")]
103+
#endif

src/Razor/src/Microsoft.VisualStudio.RazorExtension.Dependencies/Microsoft.VisualStudio.RazorExtension.Dependencies.csproj

+16-10
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
<IncludeAssemblyInVSIXContainer>false</IncludeAssemblyInVSIXContainer>
2626
<IncludeDebugSymbolsInVSIXContainer>false</IncludeDebugSymbolsInVSIXContainer>
2727
<IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment>
28+
<DefineConstants Condition="'$(IncludeRoslynDeps)' == 'true'">$(DefineConstants);INCLUDE_ROSLYN_DEPS</DefineConstants>
2829
</PropertyGroup>
2930

3031
<ItemGroup>
@@ -42,22 +43,30 @@
4243
<PackageReference Include="Microsoft.VisualStudio.Shell.15.0" Version="$(MicrosoftVisualStudioShell150PackageVersion)" />
4344
</ItemGroup>
4445

46+
<!-- Reference the LSP protocol dlls so that we can include them in the code base and output them with the VSIX. -->
4547
<ItemGroup>
46-
<!-- Reference the Roslyn dependencies so that Preview builds work -->
48+
<PackageReference Include="Microsoft.VisualStudio.LanguageServer.Protocol" Version="$(MicrosoftVisualStudioLanguageServerProtocolPackageVersion)" />
49+
<PackageReference Include="Microsoft.VisualStudio.LanguageServer.Protocol.Extensions" Version="$(MicrosoftVisualStudioLanguageServerProtocolExtensionsPackageVersion)" />
50+
<PackageReference Include="Microsoft.VisualStudio.LanguageServer.Protocol.Internal" Version="$(MicrosoftVisualStudioLanguageServerProtocolInternalPackageVersion)" />
51+
</ItemGroup>
52+
53+
<ItemGroup>
54+
<VSIXSourceItem Include="$(OutputPath)Microsoft.VisualStudio.LanguageServer.Protocol.dll" />
55+
<VSIXSourceItem Include="$(OutputPath)Microsoft.VisualStudio.LanguageServer.Protocol.Extensions.dll" />
56+
<VSIXSourceItem Include="$(OutputPath)Microsoft.VisualStudio.LanguageServer.Protocol.Internal.dll" />
57+
</ItemGroup>
58+
59+
<!-- Reference the Roslyn dependencies so that Preview builds work -->
60+
<ItemGroup Condition="'$(IncludeRoslynDeps)' == 'true'">
4761
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Features" Version="$(Tooling_MicrosoftCodeAnalysisCSharpFeaturesPackageVersion)" />
4862
<PackageReference Include="Microsoft.CodeAnalysis.EditorFeatures" Version="$(RoslynPackageVersion)" />
4963
<PackageReference Include="Microsoft.CodeAnalysis.EditorFeatures.Wpf" Version="$(RoslynPackageVersion)" />
5064
<PackageReference Include="Microsoft.CodeAnalysis.ExternalAccess.Razor" Version="$(Tooling_MicrosoftCodeAnalysisExternalAccessRazorPackageVersion)" />
5165
<PackageReference Include="Microsoft.CodeAnalysis.ExternalAccess.FSharp" Version="$(Tooling_MicrosoftCodeAnalysisExternalAccessRazorPackageVersion)" />
5266
<PackageReference Include="Microsoft.VisualStudio.LanguageServices" Version="$(Tooling_MicrosoftVisualStudioLanguageServicesPackageVersion)" />
53-
54-
<!-- Reference the LSP protocol dlls so that we can include them in the code base and output them with the VSIX. -->
55-
<PackageReference Include="Microsoft.VisualStudio.LanguageServer.Protocol" Version="$(MicrosoftVisualStudioLanguageServerProtocolPackageVersion)" />
56-
<PackageReference Include="Microsoft.VisualStudio.LanguageServer.Protocol.Extensions" Version="$(MicrosoftVisualStudioLanguageServerProtocolExtensionsPackageVersion)" />
57-
<PackageReference Include="Microsoft.VisualStudio.LanguageServer.Protocol.Internal" Version="$(MicrosoftVisualStudioLanguageServerProtocolInternalPackageVersion)" />
5867
</ItemGroup>
5968

60-
<ItemGroup>
69+
<ItemGroup Condition="'$(IncludeRoslynDeps)' == 'true'">
6170
<VSIXSourceItem Include="$(OutputPath)Microsoft.CodeAnalysis.dll" />
6271
<VSIXSourceItem Include="$(OutputPath)Microsoft.CodeAnalysis.CSharp.dll" />
6372
<VSIXSourceItem Include="$(OutputPath)Microsoft.CodeAnalysis.CSharp.Features.dll" />
@@ -72,8 +81,5 @@
7281
<VSIXSourceItem Include="$(OutputPath)Microsoft.CodeAnalysis.Remote.Workspaces.dll" />
7382
<VSIXSourceItem Include="$(OutputPath)Microsoft.CodeAnalysis.Workspaces.dll" />
7483
<VSIXSourceItem Include="$(OutputPath)Microsoft.VisualStudio.LanguageServices.dll" />
75-
<VSIXSourceItem Include="$(OutputPath)Microsoft.VisualStudio.LanguageServer.Protocol.dll" />
76-
<VSIXSourceItem Include="$(OutputPath)Microsoft.VisualStudio.LanguageServer.Protocol.Extensions.dll" />
77-
<VSIXSourceItem Include="$(OutputPath)Microsoft.VisualStudio.LanguageServer.Protocol.Internal.dll" />
7884
</ItemGroup>
7985
</Project>

0 commit comments

Comments
 (0)