Skip to content

Commit c0909bb

Browse files
committed
Add test and asset to prevent regressing the transitive behavior.
1 parent 426819a commit c0909bb

File tree

5 files changed

+53
-0
lines changed

5 files changed

+53
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net9.0</TargetFramework>
5+
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<ProjectReference Include="./Lib.esproj" />
9+
</ItemGroup>
10+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<Project Sdk="Microsoft.VisualStudio.JavaScript.SDK/1.0.1948920" />

test/TestAssets/TestProjects/ProjectWithEsProjReference/package-lock.json

+13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "lib",
3+
"version": "1.0.0",
4+
"description": "A test project to verify .NET SDK compatibility for workload restore and non-Managed projects",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"author": "",
10+
"license": "MIT"
11+
}

test/dotnet-workload-restore.Tests/GivenDotnetWorkloadRestore.cs

+18
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public GivenDotnetWorkloadRestore(ITestOutputHelper log) : base(log)
1010
}
1111

1212
public static string DcProjAssetName = "SolutionWithAppAndDcProj";
13+
public static string TransitiveReferenceNoWorkloadsAssetName = "ProjectWithEsProjReference";
1314

1415
[Fact]
1516
public void ProjectsThatDoNotSupportWorkloadsAreNotInspected()
@@ -27,4 +28,21 @@ public void ProjectsThatDoNotSupportWorkloadsAreNotInspected()
2728
// if we did try to restore the dcproj in this TestAsset we would fail, so passing means we didn't!
2829
.Pass();
2930
}
31+
32+
[Fact]
33+
public void ProjectsThatDoNotSupportWorkloadsAndAreTransitivelyReferencedDoNotBreakTheBuild()
34+
{
35+
var projectPath =
36+
_testAssetsManager
37+
.CopyTestAsset(TransitiveReferenceNoWorkloadsAssetName)
38+
.WithSource()
39+
.Path;
40+
41+
new DotnetWorkloadCommand(Log, "restore")
42+
.WithWorkingDirectory(projectPath)
43+
.Execute()
44+
.Should()
45+
// if we did try to restore the esproj in this TestAsset we would fail, so passing means we didn't!
46+
.Pass();
47+
}
3048
}

0 commit comments

Comments
 (0)