Skip to content
Closed
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 @@ -36,6 +36,7 @@
<ItemGroup>
<ManifestLines Include="&lt;SdkResolver&gt;" />
<ManifestLines Include="&lt;Path&gt;$(_TargetPathRelativePath)&lt;/Path&gt;" />
<ManifestLines Include="&lt;ResolvableSdkPattern&gt;Microsoft\..*|Samsung\..*|GtkSharp\..*|FSharp\.NET\.Sdk|NuGet\.Build\.Tasks\.Pack&lt;/ResolvableSdkPattern&gt;" />
<ManifestLines Include="&lt;/SdkResolver&gt;" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<SdkResolver>
<Path>..\..\Microsoft.DotNet.MSBuildSdkResolver.dll</Path>
<ResolvableSdkPattern>Microsoft\..*|Samsung\..*|GtkSharp\..*|FSharp\.NET\.Sdk|NuGet\.Build\.Tasks\.Pack</ResolvableSdkPattern>
</SdkResolver>
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
<ItemGroup>
<ManifestLines Include="&lt;SdkResolver&gt;" />
<ManifestLines Include="&lt;Path&gt;$(_TargetPathRelativePath)&lt;/Path&gt;" />
<ManifestLines Include="&lt;ResolvableSdkPattern&gt;Microsoft\..*|Samsung\..*|GtkSharp\..*&lt;/ResolvableSdkPattern&gt;" />
<ManifestLines Include="&lt;/SdkResolver&gt;" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<SdkResolver>
<Path>..\..\Microsoft.NET.Sdk.WorkloadMSBuildSdkResolver.dll</Path>
<ResolvableSdkPattern>Microsoft\..*|Samsung\..*|GtkSharp\..*</ResolvableSdkPattern>
</SdkResolver>
33 changes: 25 additions & 8 deletions src/VSMSBuildExtensions/VSMSBuildExtensions.proj
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,26 @@
<!-- Shared infra to build and use the sdk-tasks -->
<Import Project="$(RepoRoot)src\Tasks\sdk-tasks\sdk-tasks.InTree.targets" />

<Target Name="GenerateLayout" Condition="'$(IsPackable)' == 'true'" DependsOnTargets="ResolveProjectReferences">
<Target Name="_DeclareRewriteResolverXmlInputsAndOutputs">
<PropertyGroup>
<_ResolverXmlPath>$(ArtifactsBinDir)Microsoft.DotNet.MSBuildSdkResolver\$(Configuration)\net472\SdkResolvers\Microsoft.DotNet.MSBuildSdkResolver\Microsoft.DotNet.MSBuildSdkResolver.xml</_ResolverXmlPath>
<_RewrittenResolverXmlPath>$(OutputPath)$([System.IO.Path]::GetFileName('$(_ResolverXmlPath)'))</_RewrittenResolverXmlPath>
</PropertyGroup>
</Target>

<Target Name="_RewriteResolverXml" DependsOnTargets="_DeclareRewriteResolverXmlInputsAndOutputs" Inputs="$(_ResolverXmlPath)" Outputs="$(_RewrittenResolverXmlPath)" Returns="@(VSMSBuildExtensionsContent)">
<WriteLinesToFile File="$(_RewrittenResolverXmlPath)" Lines="$([System.IO.File]::ReadAllText($(_ResolverXmlPath)).Replace('..\..\',''))" Overwrite="true" WriteOnlyWhenDifferent="true" />

<ItemGroup>
<!-- The generated MSBuildSdkResolver XML file is emitted to the SdkResolvers directory, but needs to be installed colocated to the dll. This is hard to do using the
templating and packing mechanisms on the above lines, so for this file specifically I've hard-coded the expected layouts. -->
<VSMSBuildExtensionsContent Include="$(_RewrittenResolverXmlPath)"
DestinationPath="$(OutputPath)\MSBuildSdkResolver\Microsoft.DotNet.MSBuildSdkResolver.xml"
PackagePath="/MSBuildSdkResolver/" />
</ItemGroup>
</Target>

<Target Name="GenerateLayout" Condition="'$(IsPackable)' == 'true'" DependsOnTargets="ResolveProjectReferences;_RewriteResolverXml">
<PropertyGroup>
<MSBuildExtensionsOutputPath>$(ArtifactsBinDir)$(Configuration)\Sdks\Microsoft.NET.Build.Extensions</MSBuildExtensionsOutputPath>
<SdkMSBuildExtensionsSwrFile>$(ArtifactsNonShippingPackagesDir)VS.Redist.Common.Net.Core.SDK.MSBuildExtensions.swr</SdkMSBuildExtensionsSwrFile>
Expand Down Expand Up @@ -57,20 +76,18 @@
<VSMSBuildExtensionsContent Include="$(ArtifactsBinDir)Microsoft.DotNet.MSBuildSdkResolver\$(Configuration)\net472\**\Microsoft.Deployment.DotNet.Releases*.dll" DeploymentSubpath="MSBuildSdkResolver/" />
<VSMSBuildExtensionsContent Include="$(ArtifactsBinDir)Microsoft.DotNet.MSBuildSdkResolver\$(Configuration)\net472\**\Microsoft.DotNet.MSBuildSdkResolver*.dll" DeploymentSubpath="MSBuildSdkResolver/" />

<VSMSBuildExtensionsContent Update="@(VSMSBuildExtensionsContent)">
<DestinationPath>$(OutputPath)/%(VSMSBuildExtensionsContent.DeploymentSubpath)%(RecursiveDir)%(Filename)%(Extension)</DestinationPath>
</VSMSBuildExtensionsContent>
<VSMSBuildExtensionsContent Update="@(VSMSBuildExtensionsContent)"
DestinationPath="$([MSBuild]::ValueOrDefault(%(VSMSBuildExtensionsContent.DestinationPath), '$(OutputPath)/%(VSMSBuildExtensionsContent.DeploymentSubpath)%(RecursiveDir)%(Filename)%(Extension)'))" />
</ItemGroup>

<Copy SourceFiles="@(VSMSBuildExtensionsContent)" DestinationFiles="%(VSMSBuildExtensionsContent.DestinationPath)" />
<Copy SourceFiles="@(VSMSBuildExtensionsContent)" DestinationFiles="@(VSMSBuildExtensionsContent->'%(DestinationPath)')" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Why this change?

Copy link
Member Author

Choose a reason for hiding this comment

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

This coalesces the N Copy Task calls into a single call - this is way faster and the task internally handles up to date checking and such.

So many people unintentionally batch over this Task, we should probably have a build check for it!

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm...batching was my first thought, but I thought it would batch in either case. Batching is confusing.


<GenerateMSBuildExtensionsSWR MSBuildExtensionsLayoutDirectory="$(OutputPath)"
OutputFile="$(SdkMSBuildExtensionsSwrFile)" />
<ItemGroup>
<!-- Include the swr file in the nuget package for VS authoring -->
<Content Include="$(SdkMSBuildExtensionsSwrFile)" PackagePath="/" />
<Content Include="@(VSMSBuildExtensionsContent)" PackagePath="/%(VSMSBuildExtensionsContent.DeploymentSubpath)%(RecursiveDir)%(Filename)%(Extension)" />
<Content Include="@(VSMSBuildExtensionsContent)" PackagePath="$([MSBuild]::ValueOrDefault(%(VSMSBuildExtensionsContent.PackagePath), '/%(VSMSBuildExtensionsContent.DeploymentSubpath)%(RecursiveDir)%(Filename)%(Extension)'))" />
</ItemGroup>
</Target>

</Target>
</Project>
Loading