Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<Target Name="CopyProjectReferencesToPackage" DependsOnTargets="ResolveReferences">
<ItemGroup>
<BuildOutputInPackage Include="@(ReferenceCopyLocalPaths->WithMetadataValue('ReferenceSourceTarget', 'ProjectReference'))" />
<BuildOutputInPackage Include="@(ReferenceCopyLocalPaths-&gt;WithMetadataValue('ReferenceSourceTarget', 'ProjectReference'))" />
</ItemGroup>
</Target>

Expand All @@ -33,8 +33,36 @@
<Reference Include="System.Core" />
</ItemGroup>

<!-- To reduce dll load (cause RPS perf regression). Directly compile files from Microsoft.DotNet.SdkResolver -->
<ItemGroup>
<ProjectReference Include="..\Microsoft.DotNet.SdkResolver\Microsoft.DotNet.SdkResolver.csproj" PrivateAssets="All" />
<Compile Include="..\Microsoft.DotNet.SdkResolver\**\*.cs" LinkBase="Microsoft.DotNet.SdkResolver" />
</ItemGroup>

</Project>
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is all copied (and now duplicated from) the Microsoft.DotNet.SdkResolver project, right?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

<Reference Include="System" />
<Reference Include="System.Core" />
<PackageReference Include="Microsoft.VisualStudio.Setup.Configuration.Interop" Version="1.16.30" PrivateAssets="All" ExcludeAssets="Runtime" />
</ItemGroup>

<Target Name="ResolveHostfxrCopyLocalContent" Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'" DependsOnTargets="RunResolvePackageDependencies" BeforeTargets="AssignTargetPaths">
<ItemGroup>
<Content Include="@(FileDefinitions->'%(ResolvedPath)')" Condition="'%(FileDefinitions.Path)' == 'runtimes/win-x86/native/hostfxr.dll'">
<Link>x86/hostfxr.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="@(FileDefinitions->'%(ResolvedPath)')" Condition="'%(FileDefinitions.Path)' == 'runtimes/win-x64/native/hostfxr.dll'">
<Link>x64/hostfxr.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Target>

<Target Name="LinkVSEmbeddableAssemblies" DependsOnTargets="ResolveReferences" AfterTargets="ResolveReferences">
<ItemGroup>
<ReferencePath Condition="'%(ReferencePath.FileName)' == 'Microsoft.VisualStudio.Setup.Configuration.Interop'">
<EmbedInteropTypes>true</EmbedInteropTypes>
</ReferencePath>
</ItemGroup>
</Target>

</Project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

extern alias sdkResolver;
using FluentAssertions;
using Microsoft.Build.Framework;
using Microsoft.DotNet.MSBuildSdkResolver;
Expand Down Expand Up @@ -496,7 +497,7 @@ public void GivenTemplateLocatorItCanResolveSdkVersion()
environment.CreateMuxerAndAddToPath(ProgramFiles.X64);

var resolver = new TemplateLocator.TemplateLocator(environment.GetEnvironmentVariable,
new VSSettings(environment.VSSettingsFile?.FullName, environment.DisallowPrereleaseByDefault));
new sdkResolver::Microsoft.DotNet.DotNetSdkResolver.VSSettings(environment.VSSettingsFile?.FullName, environment.DisallowPrereleaseByDefault));
resolver.TryGetDotnetSdkVersionUsedInVs("15.8", out var version).Should().BeTrue();

version.Should().Be(sdkVersion);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
<ItemGroup>
<ProjectReference Include="..\..\Microsoft.DotNet.TemplateLocator\Microsoft.DotNet.TemplateLocator.csproj" />
<ProjectReference Include="..\..\Resolvers\Microsoft.DotNet.MSBuildSdkResolver\Microsoft.DotNet.MSBuildSdkResolver.csproj" />
<ProjectReference Include="..\..\Resolvers\Microsoft.DotNet.SdkResolver\Microsoft.DotNet.SdkResolver.csproj" />

<!-- Microsoft.DotNet.MSBuildSdkResolver compiles source of Microsoft.DotNet.SdkResolver to reduce dll load. There are duplicated types-->
<ProjectReference Include="..\..\Resolvers\Microsoft.DotNet.SdkResolver\Microsoft.DotNet.SdkResolver.csproj">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to reference the DLLs from both types? Should we just reference the MSBuildSdkResolver project and use the types from it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to reuse the setup of testing msbuildsdkresolver to test template locator's finding VS version function. It is too much to duplicate, so i just added the template locator test in msbuildsdkresolver tests. And a type from template locator's dependency chain is used in the test. So i need Microsoft.DotNet.SdkResolver too

<Aliases>sdkResolver</Aliases>
</ProjectReference>
<ProjectReference Include="..\Microsoft.NET.TestFramework\Microsoft.NET.TestFramework.csproj" />
<!--<ProjectReference Include="..\Microsoft.DotNet.Tools.Tests.Utilities\Microsoft.DotNet.Tools.Tests.Utilities.csproj" />-->
</ItemGroup>
Expand Down