When Library add reference to NETStandardLib if not present
This commit is contained in:
parent
155ef033f2
commit
57d79bb2d3
12 changed files with 130 additions and 38 deletions
|
@ -347,6 +347,36 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|||
i.GetMetadataWithName("Version").Value == "2.2.0-beta4-build1188"));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(@"
|
||||
{
|
||||
""frameworks"": {
|
||||
""netstandard1.3"": {
|
||||
""dependencies"": {
|
||||
""System.AppContext"": ""4.1.0"",
|
||||
""NETStandard.Library"": ""1.5.0""
|
||||
}
|
||||
}
|
||||
}
|
||||
}")]
|
||||
[InlineData(@"
|
||||
{
|
||||
""frameworks"": {
|
||||
""netstandard1.3"": {
|
||||
""dependencies"": {
|
||||
""System.AppContext"": ""4.1.0""
|
||||
}
|
||||
}
|
||||
}
|
||||
}")]
|
||||
public void It_migrates_library_and_does_not_double_netstandard_ref(string pjContent)
|
||||
{
|
||||
var mockProj = RunPackageDependenciesRuleOnPj(pjContent);
|
||||
|
||||
mockProj.Items.Should().ContainSingle(
|
||||
i => (i.Include == "NETStandard.Library" && i.ItemType == "PackageReference"));
|
||||
}
|
||||
|
||||
private void EmitsPackageReferences(ProjectRootElement mockProj, params Tuple<string, string, string>[] packageSpecs)
|
||||
{
|
||||
foreach (var packageSpec in packageSpecs)
|
||||
|
|
|
@ -423,6 +423,19 @@ namespace Microsoft.DotNet.Migration.Tests
|
|||
.Count().Should().Be(1);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("LibraryWithoutNetStandardLibRef")]
|
||||
[InlineData("LibraryWithNetStandardLibRef")]
|
||||
public void It_migrates_and_builds_library(string projectName)
|
||||
{
|
||||
var projectDirectory = TestAssetsManager.CreateTestInstance(projectName,
|
||||
callingMethod: $"{nameof(It_migrates_and_builds_library)}-projectName").Path;
|
||||
|
||||
MigrateProject(projectDirectory);
|
||||
Restore(projectDirectory, projectName);
|
||||
BuildMSBuild(projectDirectory, projectName);
|
||||
}
|
||||
|
||||
private void VerifyAutoInjectedDesktopReferences(string projectDirectory, string projectName, bool shouldBePresent)
|
||||
{
|
||||
if (projectName != null)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue