Skip to content

Commit

Permalink
Demonstrate removing SDK from .csproj
Browse files Browse the repository at this point in the history
  • Loading branch information
eerhardt committed May 22, 2018
1 parent eef01a9 commit ed3c014
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

<Import Project="..\Directory.Build.props" />

<PropertyGroup>
<ImportDirectoryBuildProps>false</ImportDirectoryBuildProps>
<ImportDirectoryBuildTargets>false</ImportDirectoryBuildTargets>
</PropertyGroup>

<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />

<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<!-- Not all types and members have XML docs yet.
Expand Down
2 changes: 2 additions & 0 deletions src/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@

</Target>

<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />

</Project>
4 changes: 3 additions & 1 deletion src/Microsoft.ML.Core/Microsoft.ML.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project>
<Import Project="..\Directory.Build.props" />

This comment has been minimized.

Copy link
@eerhardt

eerhardt May 22, 2018

Author Owner

No. The MSBuild engine itself doesn't know about Directory.Build.props. Instead it is the "Microsoft.Common.props" that knows about Directory.Build.props.

https://github.com/Microsoft/msbuild/blob/f72bd2eaa37476819ab7647f63d445df8055dab6/src/Tasks/Microsoft.Common.props#L22-L36

But once you remove SDK="Microsoft.NET.Sdk" from the project, nothing is importing Microsoft.Common.props anymore, thus Directoy.Build.props is no longer getting imported.


<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
Expand All @@ -11,4 +12,5 @@
<Folder Include="Properties\" />
</ItemGroup>

<Import Project="..\Directory.Build.targets" />
</Project>
4 changes: 3 additions & 1 deletion src/Microsoft.ML/Microsoft.ML.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project>
<Import Project="..\Directory.Build.props" />

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
Expand All @@ -20,4 +21,5 @@
<ProjectReference Include="..\Microsoft.ML.Transforms\Microsoft.ML.Transforms.csproj" />
</ItemGroup>

<Import Project="..\Directory.Build.targets" />
</Project>

0 comments on commit ed3c014

Please sign in to comment.