Skip to content

Commit f5ce52e

Browse files
committed
Add test specifically for this case
1 parent 27f7f91 commit f5ce52e

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildADesktopLibrary.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,32 @@ public void It_can_preserve_compilation_context_and_reference_netstandard_librar
225225
}
226226
}
227227

228+
[Theory]
229+
[InlineData("RazorSimpleMvc22", "netcoreapp2.2", "SimpleMvc22")]
230+
[InlineData("DesktopReferencingNetStandardLibrary", "net46", "Library")]
231+
public void PackageReferences_with_private_assets_do_not_appear_in_deps_file(string asset, string targetFramework, string exeName)
232+
{
233+
var testAsset = _testAssetsManager
234+
.CopyTestAsset(asset)
235+
.WithSource();
236+
237+
var buildCommand = new BuildCommand(testAsset);
238+
buildCommand.Execute().Should().Pass();
239+
240+
using (var depsJsonFileStream = File.OpenRead(Path.Combine(buildCommand.GetOutputDirectory(targetFramework).FullName, exeName + ".deps.json")))
241+
{
242+
var dependencyContext = new DependencyContextJsonReader().Read(depsJsonFileStream);
243+
if (asset.Equals("DesktopReferencingNetStandardLibrary"))
244+
{
245+
dependencyContext.CompileLibraries.Any(l => l.Name.Equals("Library")).Should().BeTrue();
246+
}
247+
else
248+
{
249+
dependencyContext.CompileLibraries.Any(l => l.Name.Equals("Microsoft.AspNetCore.App")).Should().BeFalse();
250+
}
251+
}
252+
}
253+
228254
[WindowsOnlyFact]
229255
public void It_resolves_assembly_conflicts_with_a_NETFramework_library()
230256
{

0 commit comments

Comments
 (0)