Skip to content

Commit

Permalink
Integrate Solution SDK into legacy solutions
Browse files Browse the repository at this point in the history
- This starts small with very specific properties set.

- A little bit improvisation in recognition of
  un-supported projects and eliminating them
  from the Build process.
  • Loading branch information
Nirmal4G committed Dec 2, 2021
1 parent d9c591f commit 78c5c6e
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 7 deletions.
1 change: 0 additions & 1 deletion Directory.Build.rsp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
-NoLogo
-Restore
-MaxCPUCount
-BinaryLogger
-NodeReuse:False
Expand Down
6 changes: 2 additions & 4 deletions Directory.Solution.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
<RestoreUseStaticGraphEvaluation>True</RestoreUseStaticGraphEvaluation>
</PropertyGroup>

<PropertyGroup Label="Solution">
<ImportByWildcardAfterSolution>False</ImportByWildcardAfterSolution>
<ImportByWildcardBeforeSolution>False</ImportByWildcardBeforeSolution>
</PropertyGroup>
<!-- Integrate with the Solution SDK for Legacy Solution files -->
<Import Sdk="MSBuild.Solution.Sdk" Project="Sdk.Legacy.props"/>

</Project>
4 changes: 2 additions & 2 deletions Directory.Solution.targets
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>

<!-- Enable Solution-wide Package Restore through our SDK -->
<Import Sdk="MSBuild.NET.Legacy.Sdk" Project="NuGet.Restore.targets"/>
<!-- Integrate with the Solution SDK for Legacy Solution files -->
<Import Sdk="MSBuild.Solution.Sdk" Project="Sdk.Legacy.targets"/>

</Project>
11 changes: 11 additions & 0 deletions Sources/MSBuild.Solution.Sdk/Sdk/Sdk.Legacy.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project>

<PropertyGroup Label="Solution">
<ImportByWildcardAfterSolution>False</ImportByWildcardAfterSolution>
<ImportByWildcardBeforeSolution>False</ImportByWildcardBeforeSolution>
</PropertyGroup>

<!-- Enable Solution-wide Central Package Management through our SDK -->
<Import Sdk="NuGet.Build.Sdk" Project="Sdk.Extensions.props"/>

</Project>
16 changes: 16 additions & 0 deletions Sources/MSBuild.Solution.Sdk/Sdk/Sdk.Legacy.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project>

<Target Name="RemoveUnSupportedProjectsFromRestore"
BeforeTargets="Restore;_LoadRestoreGraphEntryPoints;_GenerateProjectRestoreGraphPerFramework;_GenerateRestoreProjectPathItemsPerFramework">
<ItemGroup>
<UnSupportedProjectReference Include="@(ProjectReference->WithMetadataValue('Extension', '.nuproj'))" />
<ProjectReference Remove="@(UnSupportedProjectReference)" />
</ItemGroup>
<Message Importance="High" Condition="@(UnSupportedProjectReference->Count()) > 0"
Text="Restore is not currently supported for NuGet packaging projects (i.e., MSBuild projects with file extension 'nuproj')."/>
</Target>

<!-- Enable Solution-wide Package Restore through our SDK -->
<Import Sdk="NuGet.Build.Sdk" Project="Sdk.Restore.targets" />

</Project>
1 change: 1 addition & 0 deletions global.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{
"MSBuild.Core.Sdk": "1.0.0-dev.*",
"MSBuild.Common.Sdk": "1.0.0-dev.*",
"MSBuild.Solution.Sdk": "1.0.0-dev.*",

"MSBuild.NET.Sdk": "1.0.0-dev.*",
"MSBuild.NET.Legacy.Sdk": "1.0.0-dev.*",
Expand Down

0 comments on commit 78c5c6e

Please sign in to comment.