Skip to content

Commit

Permalink
Use .NET Test SDK instead of regular one
Browse files Browse the repository at this point in the history
- This adds props and targets from "Microsoft.NET.Test.Sdk".
- Detect if using NuGet's Central Package versioning.
- Fix some mistakes in the NuGet project files.
  • Loading branch information
Nirmal4G committed Dec 2, 2021
1 parent 78c5c6e commit c25ee51
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<Import Project="$(DirectoryPackagesProps)" Condition="Exists('$(DirectoryPackagesProps)')"/>

<PropertyGroup Condition="Exists('$(DirectoryPackagesProps)')">
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageVersionsFileImported>true</CentralPackageVersionsFileImported>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion Sources/NuGet.Build.Sdk/NuGet.Build.Sdk.nuproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<PackageTags>$(PackageTags);nuget;build;pack;package;restore;dependency;reference</PackageTags>
<Summary>An MSBuild SDK package that provides package reference support and dependency management to the projects.</Summary>
<Description>$(Summary) It adds a `Restore` target which facilitates downloading and referencing shared libraries from a remote server.</Description>
<Description>$(Summary) It also adds a `Pack` target which facilitates creation of such packages using project outputs with pre-determined layouts.</Description>
<Description>$(Description) It also adds a `Pack` target which facilitates creation of such packages using project outputs with pre-determined layouts.</Description>
<Description>$(Description) It can be used either directly on your project (_via the `<Sdk/>` element_) or in-directly (_via other SDKs which refer to it internally_).</Description>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion Sources/NuGet.Packaging.Sdk/NuGet.Packaging.Sdk.nuproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<Title>NuGet Packaging Sdk</Title>
<PackageId>NuGet.Packaging.Sdk</PackageId>
<PackageVersion Condition="'$(PackageVersion)' == ''">1.0.0</PackageVersion>
<PackageTags>$(PackageTags);nuget;build;packaging;project;sysytem;nuproj;pkgproj;sfxproj</PackageTags>
<PackageTags>$(PackageTags);nuget;build;packaging;project;system;nuproj;pkgproj;sfxproj</PackageTags>
<Summary>An MSBuild SDK package that provides Project System support for NuGet package authoring.</Summary>
<Description>$(Summary) Having a separate Project System makes it possible to author complex NuGet packages, otherwise not possible with Pack targets.</Description>
<Description>$(Description) One such need is to create a completely customized package with a custom layout that is different from the standard layout.</Description>
Expand Down
24 changes: 0 additions & 24 deletions Tests/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,12 @@

<Import Project="..\$(MSBuildThisFile)"/>

<PropertyGroup Label="Build">
<NoWarn>NU1507</NoWarn>
<ManagePackageVersionsCentrally>True</ManagePackageVersionsCentrally>
<RestoreUseStaticGraphEvaluation>True</RestoreUseStaticGraphEvaluation>
</PropertyGroup>

<PropertyGroup Label="Compiler">
<Features>Strict</Features>
<Nullable>Enable</Nullable>
<LangVersion>Latest</LangVersion>
</PropertyGroup>

<Choose>
<When Condition="$(MSBuildProjectName.EndsWith('Tests'))">
<PropertyGroup>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\MSBuild.TestFramework\MSBuild.TestFramework.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="MSTest.TestAdapter" />
<PackageReference Include="MSTest.TestFramework" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
</ItemGroup>
</When>

<Otherwise/>
</Choose>

</Project>
3 changes: 1 addition & 2 deletions Tests/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<Project>

<PropertyGroup Condition="'$(IsTestProject)' == 'true' AND '$(TargetFrameworkIdentifier)' == '.NETCoreApp'">
<GenerateProgramFile>false</GenerateProgramFile>
<GeneratedProgramFile>Program$(DefaultLanguageSourceExtension)</GeneratedProgramFile>
<EnableDefaultProgramFile>false</EnableDefaultProgramFile>
</PropertyGroup>

<Import Project="..\$(MSBuildThisFile)"/>
Expand Down
10 changes: 3 additions & 7 deletions Tests/Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<Project>

<PropertyGroup Label="Core">
<!-- .NET Standard -->
<NETStandardImplicitPackageVersion>2.0.3</NETStandardImplicitPackageVersion>
<!-- MSTest -->
<MSTestImplicitPackageVersion>2.2.8</MSTestImplicitPackageVersion>
</PropertyGroup>

<ItemGroup Label="Core">
Expand All @@ -11,11 +14,4 @@
<PackageVersion Version="17.0.0" Include="Microsoft.Build.Utilities.Core" />
</ItemGroup>

<ItemGroup Label="Test">
<!-- MSTest -->
<PackageVersion Version="2.2.8" Include="MSTest.TestAdapter" />
<PackageVersion Version="2.2.8" Include="MSTest.TestFramework" />
<PackageVersion Version="17.0.0" Include="Microsoft.NET.Test.Sdk" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion Tests/MSBuild.Core.Tests/MSBuild.Core.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="MSBuild.NET.Sdk">
<Project Sdk="MSBuild.NET.Test.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net472</TargetFrameworks>
Expand Down
2 changes: 1 addition & 1 deletion Tests/MSBuild.NET.Tests/MSBuild.NET.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="MSBuild.NET.Sdk">
<Project Sdk="MSBuild.NET.Test.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net472</TargetFrameworks>
Expand Down
1 change: 1 addition & 0 deletions global.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"MSBuild.Solution.Sdk": "1.0.0-dev.*",

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

"NuGet.Build.Sdk": "1.0.0-dev.*",
Expand Down

0 comments on commit c25ee51

Please sign in to comment.