Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
9 changes: 8 additions & 1 deletion src/Traversal.UnitTests/TraversalTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,15 @@ public void PropertiesAreSet(string target)
[InlineData("RestoreProjectStyle", null, "PackageReference")]
[InlineData("StopOnFirstFailure", "false", "false")]
[InlineData("StopOnFirstFailure", null, "true")]
#if NETFRAMEWORK || NET9_0 // These map how MSBuild.ProjectCreation chooses SDK versions given the TFM of the test
[InlineData("TargetFramework", "net6.0", "net6.0")]
[InlineData("TargetFramework", null, "net45")]
[InlineData("TargetFramework", null, "net9.0")]
#elif NET8_0
[InlineData("TargetFramework", "net6.0", "net6.0")]
[InlineData("TargetFramework", null, "net8.0")]
#else
#error "Update test data for the given target framework"
#endif
[InlineData("TraversalProjectNames", "custom.proj", "custom.proj")]
[InlineData("TraversalProjectNames", null, "dirs.proj")]
[InlineData("UsingMicrosoftTraversalSdk", null, "true")]
Expand Down
5 changes: 3 additions & 2 deletions src/Traversal/Sdk/Traversal.targets
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@
<EnableDefaultItems>false</EnableDefaultItems>

<!--
TargetFramework is required for restore and used to default to .NET Framework v4.5. However, Traversal projects don't specify a version so it needs to be defaulted here.
TargetFramework is required for restore. If the user specifies a version, use that. Otherwise, use the
NETCoreAppMaximumVersion so that the project acts as if it were part of the SDK.
-->
<TargetFramework Condition="'$(TargetFramework)' == ''">net45</TargetFramework>
<TargetFramework Condition=" '$(TargetFramework)' == '' ">net$(NETCoreAppMaximumVersion)</TargetFramework>
</PropertyGroup>

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