Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions Roslyn.sln
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ExternalAccess", "ExternalA
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.LanguageServer.Protocol.Test.Utilities", "src\LanguageServer\Protocol.TestUtilities\Microsoft.CodeAnalysis.LanguageServer.Protocol.Test.Utilities.csproj", "{7465CE63-A7B7-475F-8C57-48D2F8BC665A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MSBuild", "MSBuild", "{CCEB94EC-E0BB-4A6E-861A-CAD7E9F082F8}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "WorkspacesMSBuildShared", "src\Workspaces\MSBuild\Shared\WorkspacesMSBuildShared.shproj", "{01A9F592-43BD-4B0D-949B-06DFA1A79599}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.LanguageServer.ExternalAccess.Copilot", "src\LanguageServer\ExternalAccess\Copilot\Microsoft.CodeAnalysis.LanguageServer.ExternalAccess.Copilot.csproj", "{900168D7-D982-86CE-5097-C5F173BA4D8B}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Microsoft.CodeAnalysis.Threading", "src\Dependencies\Threading\Microsoft.CodeAnalysis.Threading.shproj", "{967723E8-4FDD-447B-99F6-4F8C47CB5433}"
Expand Down Expand Up @@ -1471,7 +1475,7 @@ Global
{E3FDC65F-568D-4E2D-A093-5132FD3793B7} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5}
{909B656F-6095-4AC2-A5AB-C3F032315C45} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC}
{2E87FA96-50BB-4607-8676-46521599F998} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5}
{96EB2D3B-F694-48C6-A284-67382841E086} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5}
{96EB2D3B-F694-48C6-A284-67382841E086} = {CCEB94EC-E0BB-4A6E-861A-CAD7E9F082F8}
{21B239D0-D144-430F-A394-C066D58EE267} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5}
{57CA988D-F010-4BF2-9A2E-07D6DCD2FF2C} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5}
{1A3941F1-1E1F-4EF7-8064-7729C4C2E2AA} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC}
Expand Down Expand Up @@ -1565,7 +1569,7 @@ Global
{60166C60-813C-46C4-911D-2411B4ABBC0F} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC}
{FC2AE90B-2E4B-4045-9FDD-73D4F5ED6C89} = {C2D1346B-9665-4150-B644-075CF1636BAA}
{49E7C367-181B-499C-AC2E-8E17C81418D6} = {C2D1346B-9665-4150-B644-075CF1636BAA}
{037F06F0-3BE8-42D0-801E-2F74FC380AB8} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5}
{037F06F0-3BE8-42D0-801E-2F74FC380AB8} = {CCEB94EC-E0BB-4A6E-861A-CAD7E9F082F8}
{2F11618A-9251-4609-B3D5-CE4D2B3D3E49} = {5CA5F70E-0FDB-467B-B22C-3CD5994F0087}
{CFA94A39-4805-456D-A369-FC35CCC170E9} = {C52D8057-43AF-40E6-A01B-6CDBB7301985}
{C52D8057-43AF-40E6-A01B-6CDBB7301985} = {3F40F71B-7DCF-44A1-B15C-38CA34824143}
Expand Down Expand Up @@ -1665,7 +1669,7 @@ Global
{09E88382-0D7B-4A15-B1AF-0B89A5B67227} = {8DBA5174-B0AA-4561-82B1-A46607697753}
{A833B11C-5072-4A1F-A32B-2700433B0D3D} = {806F0C6F-3640-4C92-8D55-6767B1535467}
{8988270E-393A-4B92-AC1A-534F903CFD34} = {8977A560-45C2-4EC2-A849-97335B382C74}
{B1481D94-682E-46EC-ADBE-A16EB46FEEE9} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5}
{B1481D94-682E-46EC-ADBE-A16EB46FEEE9} = {CCEB94EC-E0BB-4A6E-861A-CAD7E9F082F8}
{09AEDEE4-6358-47C9-8022-3BD37A518070} = {5880FECB-91F1-4AB8-8726-75EAFA8A918E}
{5BABC440-4F1B-46E8-9068-DD7F02ED25D3} = {3E5FE3DB-45F7-4D83-9097-8F05D3B3AEC6}
{5762E483-75CE-4328-A410-511F30737712} = {3E5FE3DB-45F7-4D83-9097-8F05D3B3AEC6}
Expand All @@ -1682,6 +1686,8 @@ Global
{1AE9182D-B03E-4B00-B32E-37AE01715F57} = {EE97CB90-33BB-4F3A-9B3D-69375DEC6AC6}
{806F0C6F-3640-4C92-8D55-6767B1535467} = {D449D505-CC6A-4E0B-AF1B-976E2D0AE67A}
{7465CE63-A7B7-475F-8C57-48D2F8BC665A} = {D449D505-CC6A-4E0B-AF1B-976E2D0AE67A}
{CCEB94EC-E0BB-4A6E-861A-CAD7E9F082F8} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5}
{01A9F592-43BD-4B0D-949B-06DFA1A79599} = {CCEB94EC-E0BB-4A6E-861A-CAD7E9F082F8}
{900168D7-D982-86CE-5097-C5F173BA4D8B} = {806F0C6F-3640-4C92-8D55-6767B1535467}
{5D60CF30-28A9-9F0F-7610-D90E4A69AE73} = {58A2876A-618D-4AE6-A136-E44B42BBDE11}
{967723E8-4FDD-447B-99F6-4F8C47CB5433} = {C2D1346B-9665-4150-B644-075CF1636BAA}
Expand All @@ -1696,6 +1702,7 @@ Global
src\Analyzers\VisualBasic\CodeFixes\VisualBasicCodeFixes.projitems*{0141285d-8f6c-42c7-baf3-3c0ccd61c716}*SharedItemsImports = 5
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\VisualBasicWorkspaceExtensions.projitems*{0141285d-8f6c-42c7-baf3-3c0ccd61c716}*SharedItemsImports = 5
src\Compilers\CSharp\csc\CscCommandLine.projitems*{0161e25c-918a-4dc8-9648-30fdcc8e31e9}*SharedItemsImports = 5
src\Workspaces\MSBuild\Shared\WorkspacesMSBuildShared.projitems*{01a9f592-43bd-4b0d-949b-06dfa1a79599}*SharedItemsImports = 13
src\Dependencies\Contracts\Microsoft.CodeAnalysis.Contracts.projitems*{0c2e1633-1462-4712-88f4-a0c945bad3a8}*SharedItemsImports = 5
src\Analyzers\Core\CodeFixes\CodeFixes.projitems*{1b6c4a1a-413b-41fb-9f85-5c09118e541b}*SharedItemsImports = 13
src\Compilers\Core\AnalyzerDriver\AnalyzerDriver.projitems*{1ee8cad3-55f9-4d91-96b2-084641da9a6c}*SharedItemsImports = 5
Expand Down Expand Up @@ -1754,6 +1761,7 @@ Global
src\Dependencies\Threading\Microsoft.CodeAnalysis.Threading.projitems*{8e2a252e-a140-45a6-a81a-2652996ea589}*SharedItemsImports = 5
src\Analyzers\VisualBasic\Analyzers\VisualBasicAnalyzers.projitems*{94faf461-2e74-4dbb-9813-6b2cde6f1880}*SharedItemsImports = 13
src\Compilers\Server\VBCSCompiler\VBCSCompilerCommandLine.projitems*{9508f118-f62e-4c16-a6f4-7c3b56e166ad}*SharedItemsImports = 5
src\Workspaces\MSBuild\Shared\WorkspacesMSBuildShared.projitems*{96eb2d3b-f694-48c6-a284-67382841e086}*SharedItemsImports = 5
src\Dependencies\Threading\Microsoft.CodeAnalysis.Threading.projitems*{967723e8-4fdd-447b-99f6-4f8c47cb5433}*SharedItemsImports = 13
src\Compilers\VisualBasic\vbc\VbcCommandLine.projitems*{975cd834-45f4-4ea0-a395-cb60dbd0e214}*SharedItemsImports = 5
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\WorkspaceExtensions.projitems*{99f594b1-3916-471d-a761-a6731fc50e9a}*SharedItemsImports = 13
Expand All @@ -1772,6 +1780,7 @@ Global
src\Dependencies\Collections\Microsoft.CodeAnalysis.Collections.projitems*{b1481d94-682e-46ec-adbe-a16eb46feee9}*SharedItemsImports = 5
src\Dependencies\Contracts\Microsoft.CodeAnalysis.Contracts.projitems*{b1481d94-682e-46ec-adbe-a16eb46feee9}*SharedItemsImports = 5
src\Dependencies\PooledObjects\Microsoft.CodeAnalysis.PooledObjects.projitems*{b1481d94-682e-46ec-adbe-a16eb46feee9}*SharedItemsImports = 5
src\Workspaces\MSBuild\Shared\WorkspacesMSBuildShared.projitems*{b1481d94-682e-46ec-adbe-a16eb46feee9}*SharedItemsImports = 5
src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpAnalyzerDriver.projitems*{b501a547-c911-4a05-ac6e-274a50dff30e}*SharedItemsImports = 5
src\ExpressionEvaluator\Core\Source\ResultProvider\ResultProvider.projitems*{bb3ca047-5d00-48d4-b7d3-233c1265c065}*SharedItemsImports = 13
src\Dependencies\Contracts\Microsoft.CodeAnalysis.Contracts.projitems*{bd9539eb-aa5e-4e67-ac7f-97d7cbc4d0c9}*SharedItemsImports = 5
Expand Down
3 changes: 2 additions & 1 deletion eng/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
<PackageVersion Include="Nerdbank.Streams" Version="2.11.79" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="StreamJsonRpc" Version="2.20.8-beta" />

<!--
VS Debugger
-->
Expand Down Expand Up @@ -197,6 +197,7 @@
<PackageVersion Include="System.Numerics.Vectors" Version="$(SystemNumericsVectorsVersion)" />
<PackageVersion Include="System.Runtime.CompilerServices.Unsafe" Version="$(SystemRuntimeCompilerServicesUnsafeVersion)" />
<PackageVersion Include="System.Resources.Extensions" Version="$(SystemResourcesExtensionsVersion)" />
<PackageVersion Include="System.Security.AccessControl" Version="6.0.0" />
<PackageVersion Include="System.Security.Cryptography.ProtectedData" Version="$(SystemSecurityCryptographyProtectedDataVersion)" />
<PackageVersion Include="System.Security.Permissions" Version="$(SystemSecurityPermissionsVersion)" />
<PackageVersion Include="System.Text.Encoding.CodePages" Version="7.0.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,11 @@ public async Task OpenSolutionAsync(string solutionFilePath)
_logger.LogInformation(string.Format(LanguageServerResources.Loading_0, solutionFilePath));
_workspaceFactory.ProjectSystemProjectFactory.SolutionPath = solutionFilePath;

// We'll load solutions out-of-proc, since it's possible we might be running on a runtime that doesn't have a matching SDK installed,
// and we don't want any MSBuild registration to set environment variables in our process that might impact child processes.
// We'll load solutions out-of-proc, since it's possible we might be running on a runtime that doesn't have a matching SDK installed and
// we aren't deploying MSBuild with our server. We wouldn't want to use MSBuildLocator anyways in case that sets environment variables that
// cause problems for child processes.
await using var buildHostProcessManager = new BuildHostProcessManager(globalMSBuildProperties: AdditionalProperties, loggerFactory: _loggerFactory);
var buildHost = await buildHostProcessManager.GetBuildHostAsync(BuildHostProcessKind.NetCore, CancellationToken.None);

// If we don't have a .NET Core SDK on this machine at all, try .NET Framework
if (!await buildHost.HasUsableMSBuildAsync(solutionFilePath, CancellationToken.None))
{
var kind = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? BuildHostProcessKind.NetFramework : BuildHostProcessKind.Mono;
buildHost = await buildHostProcessManager.GetBuildHostAsync(kind, CancellationToken.None);
}
var (buildHost, _) = await buildHostProcessManager.GetBuildHostWithFallbackAsync(GetKindForCurrentProcess(), solutionFilePath, CancellationToken.None);

foreach (var project in await buildHost.GetProjectsInSolutionAsync(solutionFilePath, CancellationToken.None))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,9 @@
<_File Include="$(ArtifactsBinDir)Microsoft.CodeAnalysis.VisualBasic.Features\$(Configuration)\netstandard2.0\Microsoft.CodeAnalysis.VisualBasic.Features.dll" TargetDir="" />
<_File Include="$(ArtifactsBinDir)Microsoft.CodeAnalysis.VisualBasic.Workspaces\$(Configuration)\netstandard2.0\Microsoft.CodeAnalysis.VisualBasic.Workspaces.dll" TargetDir="" />
<_File Include="$(ArtifactsBinDir)Microsoft.CodeAnalysis.VisualBasic\$(Configuration)\netstandard2.0\Microsoft.CodeAnalysis.VisualBasic.dll" TargetDir="" />
<_File Include="$(ArtifactsBinDir)Microsoft.CodeAnalysis.Workspaces.MSBuild\$(Configuration)\net472\Microsoft.CodeAnalysis.Workspaces.MSBuild.dll" TargetDir="" />
<_File Include="$(ArtifactsBinDir)Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost\$(Configuration)\net472\Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.exe" TargetDir="" />
<_File Include="$(ArtifactsBinDir)Microsoft.CodeAnalysis.Workspaces\$(Configuration)\netstandard2.0\Microsoft.CodeAnalysis.Workspaces.dll" TargetDir="" />
<_File Include="$(ArtifactsBinDir)Microsoft.CodeAnalysis.Workspaces.Desktop\$(Configuration)\net472\Microsoft.CodeAnalysis.Workspaces.Desktop.dll" TargetDir="" />
<_File Include="$(ArtifactsBinDir)Microsoft.CodeAnalysis.Workspaces.MSBuild\$(Configuration)\netstandard2.0\Microsoft.CodeAnalysis.Workspaces.MSBuild.dll" TargetDir="" />
<_File Include="$(ArtifactsBinDir)Microsoft.VisualStudio.LanguageServices.CSharp\$(Configuration)\net472\Microsoft.VisualStudio.LanguageServices.CSharp.dll" TargetDir="" />
<_File Include="$(ArtifactsBinDir)Microsoft.VisualStudio.LanguageServices.Implementation\$(Configuration)\net472\Microsoft.VisualStudio.LanguageServices.Implementation.dll" TargetDir="" />
<_File Include="$(ArtifactsBinDir)Microsoft.VisualStudio.LanguageServices.LiveShare\$(Configuration)\net472\Microsoft.VisualStudio.LanguageServices.LiveShare.dll" TargetDir="" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1177,6 +1177,7 @@ Microsoft.CodeAnalysis.CSharp.ForEachStatementInfo.get_GetEnumeratorMethod
Microsoft.CodeAnalysis.CSharp.ForEachStatementInfo.get_IsAsynchronous
Microsoft.CodeAnalysis.CSharp.ForEachStatementInfo.get_MoveNextMethod
Microsoft.CodeAnalysis.CSharp.InterceptableLocation
Microsoft.CodeAnalysis.CSharp.InterceptableLocation.Equals(Microsoft.CodeAnalysis.CSharp.InterceptableLocation)
Microsoft.CodeAnalysis.CSharp.InterceptableLocation.Equals(System.Object)
Microsoft.CodeAnalysis.CSharp.InterceptableLocation.GetDisplayLocation
Microsoft.CodeAnalysis.CSharp.InterceptableLocation.GetHashCode
Expand Down
1 change: 0 additions & 1 deletion src/VisualStudio/Setup/Roslyn.VisualStudio.Setup.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
<!-- Make sure we include ContentFilesProjectOutputGroup so we get the BuildHosts deployed into the VSIX -->
<IncludeOutputGroupsInVSIX>BuiltProjectOutputGroup;SatelliteDllsProjectOutputGroup;ContentFilesProjectOutputGroup</IncludeOutputGroupsInVSIX>
<ForceIncludeInVSIX>true</ForceIncludeInVSIX>
<AdditionalProperties>TargetFramework=net472</AdditionalProperties>
<PkgDefEntry>BindingRedirect</PkgDefEntry>

<!-- Disable ngen. If we don't set this, ngen is enabled for all binaries coming from this ProjectReference, which includes the build hosts coming in as content.
Expand Down
14 changes: 13 additions & 1 deletion src/Workspaces/MSBuild/BuildHost/BuildHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Collections.Immutable;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
Expand Down Expand Up @@ -145,11 +146,22 @@ private void EnsureMSBuildLoaded(string projectFilePath)
// WARNING: do not use a lambda in this function, as it internally will be put in a class that contains other lambdas used in
// TryEnsureMSBuildLoaded; on Mono this causes type load errors.

var projectFilter = ImmutableHashSet<string>.Empty;
if (SolutionFilterReader.IsSolutionFilterFilename(solutionFilePath))
(solutionFilePath, projectFilter) = SolutionFilterReader.Read(solutionFilePath);

var builder = ImmutableArray.CreateBuilder<(string ProjectPath, string ProjectGuid)>();

foreach (var project in SolutionFile.Parse(solutionFilePath).ProjectsInOrder)
{
if (project.ProjectType != SolutionProjectType.SolutionFolder)
if (project.ProjectType == SolutionProjectType.SolutionFolder)
{
continue;
}

// Load project if we have an empty project filter and the project path is present.
if (projectFilter.IsEmpty ||
projectFilter.Contains(project.AbsolutePath))
{
builder.Add((project.AbsolutePath, project.ProjectGuid));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
<TargetFrameworks>$(NetRoslynBuildHostNetCoreVersion);net472</TargetFrameworks>
<!-- We'll always be running our build host with the same host that is used to launch the language server process directly, so we don't need to create another one -->
<UseAppHost>false</UseAppHost>
<!-- Set to false since it's also set in Microsoft.CodeAnalysis.LanguageServer -->
<SelfContained>false</SelfContained>
<!-- We don't ship a regular NuGet package for this (it gets included in the Workspaces.MSBuild package directly), but we still need to publish symbols -->
<IsSymbolPublishingPackage>true</IsSymbolPublishingPackage>
<!-- Explicitly mark ourselves as AnyCPU; if we don't do this, since this project is an executable targeting net472, the SDK has logic that assumes we're targeting Windows
Expand Down Expand Up @@ -47,6 +45,7 @@
<PackageReference Include="System.Collections.Immutable" />
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="Microsoft.IO.Redist" Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'" />
<PackageReference Include="System.Text.Json" Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'" />
<PackageReference Include="System.Threading.Tasks.Extensions" Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'" />
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -80,18 +79,15 @@
<PublicAPI Include="PublicAPI.Shipped.txt" />
<PublicAPI Include="PublicAPI.Unshipped.txt" />
</ItemGroup>

<ItemGroup>
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.LanguageServer" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests" />
<InternalsVisibleTo Include="DynamicProxyGenAssembly2" Key="$(MoqPublicKey)" LoadsWithinVisualStudio="false" />
</ItemGroup>

<ItemGroup>
<None Include="Rpc\Readme.md" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="WorkspaceMSBuildBuildHostResources.resx" GenerateSource="true" />
</ItemGroup>
Expand All @@ -110,5 +106,6 @@
<Import Project="..\..\..\Dependencies\PooledObjects\Microsoft.CodeAnalysis.PooledObjects.projitems" Label="Shared" />
<Import Project="..\..\..\Dependencies\Collections\Microsoft.CodeAnalysis.Collections.projitems" Label="Shared" />
<Import Project="..\..\..\Dependencies\Contracts\Microsoft.CodeAnalysis.Contracts.projitems" Label="Shared" />
<Import Project="$(RepositoryEngineeringDir)targets\PackageDownloadAndReference.targets" />
<Import Project="$(RepositoryEngineeringDir)targets\PackageDownloadAndReference.targets"/>
<Import Project="..\Shared\WorkspacesMSBuildShared.projitems" Label="Shared" />
</Project>
4 changes: 4 additions & 0 deletions src/Workspaces/MSBuild/BuildHost/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ internal static async Task Main(string[] args)

var pipeServer = NamedPipeUtil.CreateServer(pipeName, PipeDirection.InOut);
await pipeServer.WaitForConnectionAsync().ConfigureAwait(false);
if (!NamedPipeUtil.CheckClientElevationMatches(pipeServer))
{
throw new Exception("Ownership of BuildHost pipe client is incorrect.");
}

var server = new RpcServer(pipeServer);

Expand Down
Loading
Loading