Merge branch 'rel/1.0.1' into merge_rel101_into_master

* rel/1.0.1: (66 commits)
  Update LZMA license with correct text
  Bump to 2.0.0-rc5-61427-04
  Remove duplicate installer suffix
  Add license text to LZMA SDK license notice
  Updating the SDK to 1.0.0-alpha-20170224-6
  Updating both platform abstractions and dependency model to 1.0.3.
  Bump Roslyn to 2.0.0-rc5-61424-02
  Update Stage0 to use the latest build.
  Update README with new distros.
  Back porting #5597 into rel/1.0.0
  Fixing the exclude pattern used by the Migration to exclude WEB SDK globs.
  Remove RID from test package creation
  Disable migrate and publish web app with content because CI does not have NPM
  Adding an E2E test for pack with content during migration.
  Fixing a failing test and adding a few more E2E tests around binplace content for migrated projects.
  Fix debian_config.json on ubuntu16.10
  Updating publish, pack and build of content to use None with Never/false/Never in their metadata for excluded items.
  Intermediate commit to get a WIP PR out. This adds the None Update with CopyToOutputDirectory set to Never.
  Switching the CopyToOutput for build and publish and the file for pack to use None Update instead of include. Also, fixed the exclude patterns for web apps.
  Do not migrate Content that is already included in the Web SDK for web apps.
  ...
This commit is contained in:
Livar Cunha 2017-03-01 20:50:42 -08:00
commit 3a9525b5ac
105 changed files with 1994 additions and 706 deletions

View file

@ -19,7 +19,7 @@ namespace Microsoft.DotNet.Tests.EndToEnd
{
string projectDirectory = directory.Path;
string newArgs = "console --debug:ephemeral-hive";
string newArgs = "console -f netcoreapp1.1 --debug:ephemeral-hive";
new NewCommandShim()
.WithWorkingDirectory(projectDirectory)
.Execute(newArgs)
@ -112,7 +112,7 @@ namespace Microsoft.DotNet.Tests.EndToEnd
new DotnetCommand()
.WithWorkingDirectory(testProjectDirectory)
.ExecuteWithCapturedOutput(
$"-d dependency-tool-invoker -c {configuration} -f netcoreapp1.0 portable")
$"-d dependency-tool-invoker -c {configuration} -f netcoreapp1.1 portable")
.Should().Pass()
.And.HaveStdOutContaining("Hello Portable World!");;
}

View file

@ -189,7 +189,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
.Should().Pass();
var factory = new ProjectDependenciesCommandFactory(
FrameworkConstants.CommonFrameworks.NetCoreApp10,
FrameworkConstants.CommonFrameworks.NetCoreApp11,
configuration,
null,
null,
@ -198,7 +198,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
var command = factory.Create("dotnet-tool-with-output-name", null);
command.CommandArgs.Should().Contain(
Path.Combine("toolwithoutputname", "1.0.0", "lib", "netcoreapp1.0", "dotnet-tool-with-output-name.dll"));
Path.Combine("toolwithoutputname", "1.0.0", "lib", "netcoreapp1.1", "dotnet-tool-with-output-name.dll"));
}
}
}

View file

@ -47,7 +47,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
CommandName = "dotnet-portable",
Configuration = "Debug",
ProjectDirectory = MSBuildTestProjectInstance.Root.FullName,
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp11
};
var result = projectDependenciesCommandResolver.Resolve(commandResolverArguments);
@ -83,7 +83,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
CommandName = "dotnet-portable",
Configuration = "Debug",
ProjectDirectory = MSBuildTestProjectInstance.Root.FullName,
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp11
};
var result = projectDependenciesCommandResolver.Resolve(commandResolverArguments);
@ -109,7 +109,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
CommandName = "nonexistent-command",
CommandArguments = null,
ProjectDirectory = MSBuildTestProjectInstance.Root.FullName,
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp11
};
var result = projectDependenciesCommandResolver.Resolve(commandResolverArguments);
@ -135,7 +135,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
CommandName = "dotnet-portable",
Configuration = "Debug",
ProjectDirectory = testInstance.Root.FullName,
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10,
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp11,
OutputPath = outputDir.FullName
};

View file

@ -18,7 +18,7 @@ namespace Microsoft.DotNet.Tests
public class GivenAProjectToolsCommandResolver : TestBase
{
private static readonly NuGetFramework s_toolPackageFramework =
FrameworkConstants.CommonFrameworks.NetCoreApp10;
FrameworkConstants.CommonFrameworks.NetCoreApp11;
private const string TestProjectName = "AppWithToolDependency";
@ -279,6 +279,7 @@ namespace Microsoft.DotNet.Tests
var projectToolsCommandResolver = SetupProjectToolsCommandResolver();
projectToolsCommandResolver.GenerateDepsJsonFile(
lockFile,
s_toolPackageFramework,
depsJsonFile,
new SingleProjectInfo("dotnet-portable", "1.0.0", Enumerable.Empty<ResourceAssemblyInfo>()));

View file

@ -453,11 +453,34 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
mockProj.Properties.First(p => p.Name == "GenerateDocumentationFile").Value.Should().Be("true");
}
[Fact]
public void ExcludedPatternsAreNotEmittedOnNoneWhenBuildingAWebProject()
{
var mockProj = RunBuildOptionsRuleOnPj(@"
{
""buildOptions"": {
""emitEntryPoint"": true,
""copyToOutput"": {
""include"": [""wwwroot"", ""**/*.cshtml"", ""appsettings.json"", ""web.config""],
}
},
""dependencies"": {
""Microsoft.AspNetCore.Mvc"" : {
""version"": ""1.0.0""
}
},
""frameworks"": {
""netcoreapp1.0"": {}
}
}");
mockProj.Items.Count(i => i.ItemType.Equals("None", StringComparison.Ordinal)).Should().Be(0);
}
[Theory]
[InlineData("compile", "Compile", 3, "")]
[InlineData("embed", "EmbeddedResource", 3, ";rootfile.cs")]
[InlineData("copyToOutput", "Content", 2, ";rootfile.cs")]
private void MigratingGroupIncludeExcludePopulatesAppropriateProjectItemElement(
public void MigratingGroupIncludeExcludePopulatesAppropriateProjectItemElement(
string group,
string itemName,
int expectedNumberOfCompileItems,
@ -493,8 +516,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
if (string.IsNullOrEmpty(item.Include))
{
item.Remove.Should()
.Be(@"src\**\*;rootfile.cs;src\file2.cs");
item.Remove.Should()
.Be(@"src\**\*;rootfile.cs;src\file2.cs");
}
else if (item.Include.Contains(@"src\file1.cs"))
{
@ -529,11 +552,75 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}
}
[Fact]
public void MigratingCopyToOutputIncludeExcludePopulatesAppropriateProjectItemElement()
{
var testDirectory = Temp.CreateDirectory().Path;
WriteExtraFiles(testDirectory);
var pj = @"
{
""buildOptions"": {
""copyToOutput"": {
""include"": [""root"", ""src"", ""rootfile.cs""],
""exclude"": [""anothersource"", ""rootfile1.cs""],
""includeFiles"": [""src/file1.cs"", ""src/file2.cs""],
""excludeFiles"": [""src/file3.cs""]
}
}
}";
var mockProj = RunBuildOptionsRuleOnPj(pj,
testDirectory: testDirectory);
mockProj.Items.Count(i => i.ItemType.Equals("None", StringComparison.Ordinal))
.Should().Be(4);
var copyItems = mockProj.Items.Where(i =>
i.ItemType.Equals("None", StringComparison.Ordinal) &&
i.Metadata.Any(m => m.Name == "CopyToOutputDirectory" && m.Value == "PreserveNewest"));
copyItems.Count().Should().Be(2);
var excludeItems = mockProj.Items.Where(i =>
i.ItemType.Equals("None", StringComparison.Ordinal) &&
i.Metadata.Any(m => m.Name == "CopyToOutputDirectory" && m.Value == "Never"));
excludeItems.Count().Should().Be(2);
foreach (var item in copyItems)
{
VerifyContentMetadata(item);
if (item.Update.Contains(@"src\file1.cs"))
{
item.Update.Should().Be(@"src\file1.cs;src\file2.cs");
}
else
{
item.Update.Should().Be(@"root\**\*;src\**\*;rootfile.cs");
}
}
foreach (var item in excludeItems)
{
VerifyContentMetadata(item);
if (item.Update.Contains(@"src\file3.cs"))
{
item.Update.Should().Be(@"src\file3.cs");
}
else
{
item.Update.Should().Be(@"anothersource\**\*;rootfile1.cs");
}
}
}
[Theory]
[InlineData("compile", "Compile", "")]
[InlineData("embed", "EmbeddedResource", ";rootfile.cs")]
[InlineData("copyToOutput", "Content", ";rootfile.cs")]
private void MigratingGroupIncludeOnlyPopulatesAppropriateProjectItemElement(
public void MigratingGroupIncludeOnlyPopulatesAppropriateProjectItemElement(
string group,
string itemName,
string expectedRootFiles)
@ -551,8 +638,6 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
var mockProj = RunBuildOptionsRuleOnPj(pj,
testDirectory: testDirectory);
Console.WriteLine(mockProj.RawXml);
mockProj.Items.Count(i => i.ItemType.Equals(itemName, StringComparison.Ordinal)).Should().Be(1);
var defaultIncludePatterns = GetDefaultIncludePatterns(group);
@ -586,6 +671,31 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}
}
[Theory]
[InlineData("copyToOutput", "None", ";rootfile.cs")]
public void MigratingCopyToOutputIncludeOnlyPopulatesAppropriateProjectItemElement(
string group,
string itemName,
string expectedRootFiles)
{
var testDirectory = Temp.CreateDirectory().Path;
WriteExtraFiles(testDirectory);
var pj = @"
{
""buildOptions"": {
""<group>"": [""root"", ""src"", ""rootfile.cs""]
}
}".Replace("<group>", group);
var mockProj = RunBuildOptionsRuleOnPj(pj,
testDirectory: testDirectory);
mockProj.Items.Count(i => i.ItemType.Equals(itemName, StringComparison.Ordinal)).Should().Be(1);
mockProj.Items.Single().Update.Should().Be($@"root\**\*;src\**\*{expectedRootFiles}");
}
[Fact]
public void MigratingTestProjectAddsGenerateRuntimeConfigurationFiles()
{
@ -728,7 +838,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
private static void VerifyContentMetadata(ProjectItemElement item)
{
if (item.ItemType == "Content")
if (item.ItemType == "None")
{
item.Metadata.Count(m => m.Name == "CopyToOutputDirectory").Should().Be(1);
}
@ -738,12 +848,14 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
{
Directory.CreateDirectory(Path.Combine(directory, "root"));
Directory.CreateDirectory(Path.Combine(directory, "src"));
Directory.CreateDirectory(Path.Combine(directory, "anothersource"));
File.WriteAllText(Path.Combine(directory, "root", "file1.txt"), "content");
File.WriteAllText(Path.Combine(directory, "root", "file2.txt"), "content");
File.WriteAllText(Path.Combine(directory, "root", "file3.txt"), "content");
File.WriteAllText(Path.Combine(directory, "src", "file1.cs"), "content");
File.WriteAllText(Path.Combine(directory, "src", "file2.cs"), "content");
File.WriteAllText(Path.Combine(directory, "src", "file3.cs"), "content");
File.WriteAllText(Path.Combine(directory, "anothersource", "file4.cs"), "content");
File.WriteAllText(Path.Combine(directory, "rootfile.cs"), "content");
}

View file

@ -157,9 +157,9 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
""buildOptions"": {
""copyToOutput"": {
""include"": [""src""],
""exclude"": [""src"", ""rootfile.cs""],
""exclude"": [""anothersource"", ""rootfile.cs""],
""includeFiles"": [""src/file1.cs"", ""src/file2.cs""],
""excludeFiles"": [""src/file2.cs""]
""excludeFiles"": [""anothersource/file2.cs""]
}
},
""configurations"": {
@ -167,34 +167,76 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
""buildOptions"": {
""copyToOutput"": {
""include"": [""root"", ""src"", ""rootfile.cs""],
""exclude"": [""src"", ""root/rootfile.cs""],
""exclude"": [""anothersource"", ""root/rootfile.cs""],
""includeFiles"": [""src/file1.cs"", ""src/file2.cs""],
""excludeFiles"": [""src/file2.cs""]
""excludeFiles"": [""src/file3.cs""]
}
}
}
}
}");
var contentItems = mockProj.Items.Where(item => item.ItemType == "Content");
var contentItems = mockProj.Items.Where(item => item.ItemType == "None");
contentItems.Count().Should().Be(4);
contentItems.Count().Should().Be(8);
// 2 for Base Build options
contentItems.Where(i => i.ConditionChain().Count() == 0).Should().HaveCount(2);
contentItems.Where(i => i.ConditionChain().Count() == 0).Should().HaveCount(4);
// 2 for Configuration BuildOptions (1 Remove, 1 Include)
contentItems.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(2);
var configIncludeContentItem = contentItems.First(
item => item.ConditionChain().Count() > 0 && !string.IsNullOrEmpty(item.Include));
var configRemoveContentItem = contentItems.First(
item => item.ConditionChain().Count() > 0 && !string.IsNullOrEmpty(item.Remove));
contentItems.Where(i =>
i.ConditionChain().Count() == 0 &&
i.Metadata.Any(m => m.Value == "PreserveNewest")).Should().HaveCount(2);
contentItems.Where(i =>
i.ConditionChain().Count() == 0 &&
i.Metadata.Any(m => m.Value == "Never")).Should().HaveCount(2);
// Directories are not converted to globs in the result because we did not write the directory
configRemoveContentItem.Remove.Should().Be(@"root;src;rootfile.cs");
configIncludeContentItem.Include.Should().Be(@"root;src;rootfile.cs");
configIncludeContentItem.Exclude.Should().Be(@"src;root\rootfile.cs;src\file2.cs");
contentItems.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(4);
contentItems.Where(i =>
i.ConditionChain().Count() == 1 &&
i.Metadata.Any(m => m.Value == "PreserveNewest")).Should().HaveCount(1);
contentItems.Where(i =>
i.ConditionChain().Count() == 1 &&
i.Metadata.Any(m => m.Value == "Never")).Should().HaveCount(2);
contentItems.First(i =>
i.ConditionChain().Count() == 1 &&
i.Metadata.Any(m => m.Value == "PreserveNewest") &&
!string.IsNullOrEmpty(i.Update)).Update.Should().Be(@"root;rootfile.cs");
contentItems.First(i =>
i.ConditionChain().Count() == 1 &&
i.Metadata.Any(m => m.Value == "Never") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Contains(@"src\file3.cs")).Update.Should().Be(@"src\file3.cs");
contentItems.First(i =>
i.ConditionChain().Count() == 1 &&
i.Metadata.Any(m => m.Value == "Never") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Contains(@"root\rootfile.cs")).Update.Should().Be(@"root\rootfile.cs");
contentItems.First(i =>
i.ConditionChain().Count() == 0 &&
i.Metadata.Any(m => m.Value == "PreserveNewest") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Contains(@"src\file1.cs")).Update.Should().Be(@"src\file1.cs;src\file2.cs");
contentItems.First(i =>
i.ConditionChain().Count() == 0 &&
i.Metadata.Any(m => m.Value == "PreserveNewest") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Equals(@"src")).Update.Should().Be(@"src");
contentItems.First(i =>
i.ConditionChain().Count() == 0 &&
i.Metadata.Any(m => m.Value == "Never") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Equals(@"anothersource\file2.cs")).Update.Should().Be(@"anothersource\file2.cs");
contentItems.First(i =>
i.ConditionChain().Count() == 0 &&
i.Metadata.Any(m => m.Value == "Never") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Equals(@"anothersource;rootfile.cs")).Update.Should().Be(@"anothersource;rootfile.cs");
}
[Fact]
@ -214,7 +256,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
""testconfig"": {
""buildOptions"": {
""copyToOutput"": {
""include"": [""root"", ""src"", ""rootfile.cs""],
""include"": [""root"", ""anothersource"", ""rootfile.cs""],
""exclude"": [""rootfile.cs"", ""someotherfile.cs""],
""includeFiles"": [""src/file1.cs"", ""src/file2.cs""],
""excludeFiles"": [""src/file2.cs""]
@ -224,37 +266,73 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}
}");
var contentItems = mockProj.Items.Where(item => item.ItemType == "Content");
var contentItems = mockProj.Items.Where(item => item.ItemType == "None");
contentItems.Count().Should().Be(5);
contentItems.Count().Should().Be(9);
contentItems.Where(i => i.ConditionChain().Count() == 0).Should().HaveCount(4);
contentItems.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(5);
// 2 for Base Build options
contentItems.Where(i => i.ConditionChain().Count() == 0).Should().HaveCount(2);
contentItems.Where(i =>
i.ConditionChain().Count() == 0 &&
i.Metadata.Any(m => m.Value == "PreserveNewest")).Should().HaveCount(2);
contentItems.Where(i =>
i.ConditionChain().Count() == 0 &&
i.Metadata.Any(m => m.Value == "Never")).Should().HaveCount(2);
// 3 for Configuration BuildOptions (1 Remove, 2 Include)
contentItems.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(3);
contentItems.Where(i =>
i.ConditionChain().Count() == 1 &&
i.Metadata.Any(m => m.Value == "PreserveNewest")).Should().HaveCount(1);
contentItems.Where(i =>
i.ConditionChain().Count() == 1 &&
i.Metadata.Any(m => m.Value == "Never")).Should().HaveCount(3);
var configIncludeContentItem = contentItems.First(
item => item.ConditionChain().Count() > 0
&& item.Include.Contains("root"));
contentItems.First(i =>
i.ConditionChain().Count() == 0 &&
i.Metadata.Any(m => m.Value == "PreserveNewest") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Contains(@"src\file1.cs")).Update.Should().Be(@"src\file1.cs;src\file2.cs");
var configIncludeContentItem2 = contentItems.First(
item => item.ConditionChain().Count() > 0
&& item.Include.Contains(@"src\file1.cs"));
contentItems.First(i =>
i.ConditionChain().Count() == 0 &&
i.Metadata.Any(m => m.Value == "PreserveNewest") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Equals(@"src")).Update.Should().Be(@"src");
var configRemoveContentItem = contentItems.First(
item => item.ConditionChain().Count() > 0 && !string.IsNullOrEmpty(item.Remove));
contentItems.First(i =>
i.ConditionChain().Count() == 0 &&
i.Metadata.Any(m => m.Value == "Never") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Equals(@"src\file3.cs")).Update.Should().Be(@"src\file3.cs");
// Directories are not converted to globs in the result because we did not write the directory
configRemoveContentItem.Removes()
.Should().BeEquivalentTo("root", "src", "rootfile.cs", @"src\file1.cs", @"src\file2.cs");
contentItems.First(i =>
i.ConditionChain().Count() == 0 &&
i.Metadata.Any(m => m.Value == "Never") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Equals(@"rootfile.cs")).Update.Should().Be(@"rootfile.cs");
configIncludeContentItem.Includes().Should().BeEquivalentTo("root", "src", "rootfile.cs");
configIncludeContentItem.Excludes()
.Should().BeEquivalentTo("rootfile.cs", "someotherfile.cs", @"src\file2.cs");
contentItems.First(i =>
i.ConditionChain().Count() == 1 &&
i.Metadata.Any(m => m.Value == "PreserveNewest") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Contains(@"root;anothersource")).Update.Should().Be(@"root;anothersource");
configIncludeContentItem2.Includes().Should().BeEquivalentTo(@"src\file1.cs", @"src\file2.cs");
configIncludeContentItem2.Excludes().Should().BeEquivalentTo(@"src\file2.cs");
contentItems.First(i =>
i.ConditionChain().Count() == 1 &&
i.Metadata.Any(m => m.Value == "Never") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Contains(@"src\file2.cs")).Update.Should().Be(@"src\file2.cs");
contentItems.First(i =>
i.ConditionChain().Count() == 1 &&
i.Metadata.Any(m => m.Value == "Never") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Contains(@"rootfile.cs")).Update.Should().Be(@"rootfile.cs");
contentItems.First(i =>
i.ConditionChain().Count() == 1 &&
i.Metadata.Any(m => m.Value == "Never") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Contains(@"someotherfile.cs")).Update.Should().Be(@"someotherfile.cs");
}
[Fact]
@ -280,37 +358,46 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}
}");
var contentItems = mockProj.Items.Where(item => item.ItemType == "Content");
var contentItems = mockProj.Items.Where(item => item.ItemType == "None");
contentItems.Count().Should().Be(2);
contentItems.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(2);
contentItems.Count().Should().Be(5);
contentItems.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(5);
var configIncludeContentItem = contentItems.First(
item => item.ConditionChain().Count() > 0
&& item.Include.Contains("root"));
var configIncludeContentItem2 = contentItems.First(
item => item.ConditionChain().Count() > 0
&& item.Include.Contains(@"src\file1.cs"));
configIncludeContentItem.Includes().Should().BeEquivalentTo("root", "src");
configIncludeContentItem.Excludes()
.Should().BeEquivalentTo("rootfile.cs", "src", @"src\file2.cs");
var configIncludeContentItem = contentItems.First(item => item.Update.Contains("root"));
var configIncludeContentItem2 = contentItems.First(item => item.Update.Contains(@"src\file1.cs"));
var configIncludeContentItem3 = contentItems.First(item => item.Update.Contains(@"src\file2.cs"));
var configIncludeContentItem4 = contentItems.First(item => item.Update.Equals(@"src"));
var configIncludeContentItem5 = contentItems.First(item => item.Update.Contains(@"rootfile.cs"));
configIncludeContentItem.Updates().Should().BeEquivalentTo("root");
configIncludeContentItem.GetMetadataWithName("Link").Should().NotBeNull();
configIncludeContentItem.GetMetadataWithName("Link").Value.Should().Be("/some/dir/%(FileName)%(Extension)");
configIncludeContentItem.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull();
configIncludeContentItem.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("PreserveNewest");
configIncludeContentItem2.Includes().Should().BeEquivalentTo(@"src\file1.cs", @"src\file2.cs");
configIncludeContentItem2.Excludes().Should().BeEquivalentTo(@"src\file2.cs");
configIncludeContentItem2.Updates().Should().BeEquivalentTo(@"src\file1.cs");
configIncludeContentItem2.GetMetadataWithName("Link").Should().NotBeNull();
configIncludeContentItem2.GetMetadataWithName("Link").Value.Should().Be("/some/dir/%(FileName)%(Extension)");
configIncludeContentItem2.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull();
configIncludeContentItem2.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("PreserveNewest");
configIncludeContentItem3.Updates().Should().BeEquivalentTo(@"src\file2.cs");
configIncludeContentItem3.GetMetadataWithName("Link").Should().NotBeNull();
configIncludeContentItem3.GetMetadataWithName("Link").Value.Should().Be("/some/dir/%(FileName)%(Extension)");
configIncludeContentItem3.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull();
configIncludeContentItem3.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("Never");
configIncludeContentItem4.Updates().Should().BeEquivalentTo(@"src");
configIncludeContentItem4.GetMetadataWithName("Link").Should().NotBeNull();
configIncludeContentItem4.GetMetadataWithName("Link").Value.Should().Be("/some/dir/%(FileName)%(Extension)");
configIncludeContentItem4.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull();
configIncludeContentItem4.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("Never");
configIncludeContentItem5.Updates().Should().BeEquivalentTo(@"rootfile.cs");
configIncludeContentItem5.GetMetadataWithName("Link").Should().NotBeNull();
configIncludeContentItem5.GetMetadataWithName("Link").Value.Should().Be("/some/dir/%(FileName)%(Extension)");
configIncludeContentItem5.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull();
configIncludeContentItem5.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("Never");
}
[Fact]
@ -338,47 +425,65 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}
}");
var contentItems = mockProj.Items.Where(item => item.ItemType == "Content");
var contentItems = mockProj.Items.Where(item => item.ItemType == "None");
contentItems.Count().Should().Be(3);
contentItems.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(3);
contentItems.Count().Should().Be(6);
contentItems.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(6);
var configIncludeContentItem = contentItems.First(
item => item.ConditionChain().Count() > 0
&& item.Include == "root");
&& item.Update == "root");
var configIncludeContentItem2 = contentItems.First(
item => item.ConditionChain().Count() > 0
&& item.Include == "src");
&& item.Update == "src");
var configIncludeContentItem3 = contentItems.First(
item => item.ConditionChain().Count() > 0
&& item.Include.Contains(@"src\file1.cs"));
&& item.Update.Contains(@"src\file1.cs"));
// Directories are not converted to globs in the result because we did not write the directory
var configIncludeContentItem4 = contentItems.First(
item => item.ConditionChain().Count() > 0
&& item.Update.Contains(@"src\file2.cs"));
configIncludeContentItem.Includes().Should().BeEquivalentTo("root");
configIncludeContentItem.Excludes()
.Should().BeEquivalentTo("rootfile.cs", "src", @"src\file2.cs");
var configIncludeContentItem5 = contentItems.First(
item => item.ConditionChain().Count() > 0
&& item.Update.Equals(@"rootfile.cs"));
var configIncludeContentItem6 = contentItems.First(
item => item.ConditionChain().Count() > 0
&& item.Update.Equals(@"src\rootfile.cs"));
configIncludeContentItem.Updates().Should().BeEquivalentTo("root");
configIncludeContentItem.GetMetadataWithName("Link").Should().BeNull();
configIncludeContentItem.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull();
configIncludeContentItem.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("PreserveNewest");
configIncludeContentItem2.Include.Should().Be("src");
configIncludeContentItem2.Excludes().Should().BeEquivalentTo("src", "rootfile.cs", @"src\rootfile.cs", @"src\file2.cs");
configIncludeContentItem2.Update.Should().Be("src");
configIncludeContentItem2.GetMetadataWithName("Link").Should().NotBeNull();
configIncludeContentItem2.GetMetadataWithName("Link").Value.Should().Be("/some/dir/%(FileName)%(Extension)");
configIncludeContentItem2.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull();
configIncludeContentItem2.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("PreserveNewest");
configIncludeContentItem3.Includes().Should().BeEquivalentTo(@"src\file1.cs");
configIncludeContentItem3.Exclude.Should().Be(@"src\file2.cs");
configIncludeContentItem2.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("Never");
configIncludeContentItem3.Updates().Should().BeEquivalentTo(@"src\file1.cs");
configIncludeContentItem3.GetMetadataWithName("Link").Should().BeNull();
configIncludeContentItem3.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull();
configIncludeContentItem3.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("PreserveNewest");
configIncludeContentItem4.Updates().Should().BeEquivalentTo(@"src\file2.cs");
configIncludeContentItem4.GetMetadataWithName("Link").Should().BeNull();
configIncludeContentItem4.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull();
configIncludeContentItem4.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("Never");
configIncludeContentItem5.Updates().Should().BeEquivalentTo(@"rootfile.cs");
configIncludeContentItem5.GetMetadataWithName("Link").Should().BeNull();
configIncludeContentItem5.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull();
configIncludeContentItem5.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("Never");
configIncludeContentItem6.Updates().Should().BeEquivalentTo(@"src\rootfile.cs");
configIncludeContentItem6.GetMetadataWithName("Link").Value.Should().Be("/some/dir/%(FileName)%(Extension)");
configIncludeContentItem6.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull();
configIncludeContentItem6.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("Never");
}
[Fact]
@ -410,38 +515,67 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}
}");
var contentItems = mockProj.Items.Where(item => item.ItemType == "Content");
var contentItems = mockProj.Items.Where(item => item.ItemType == "None");
contentItems.Count().Should().Be(4);
contentItems.Count().Should().Be(8);
var rootBuildOptionsContentItems = contentItems.Where(i => i.ConditionChain().Count() == 0).ToList();
rootBuildOptionsContentItems.Count().Should().Be(2);
rootBuildOptionsContentItems.Count().Should().Be(5);
foreach (var buildOptionContentItem in rootBuildOptionsContentItems)
{
buildOptionContentItem.GetMetadataWithName("Link").Should().BeNull();
buildOptionContentItem.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("PreserveNewest");
}
contentItems.First(i =>
i.ConditionChain().Count() == 0 &&
i.Metadata.Any(m => m.Value == "PreserveNewest") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Equals(@"src\file1.cs")).Update.Should().Be(@"src\file1.cs");
contentItems.First(i =>
i.ConditionChain().Count() == 0 &&
i.Metadata.Any(m => m.Value == "PreserveNewest") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Equals(@"root")).Update.Should().Be(@"root");
contentItems.First(i =>
i.ConditionChain().Count() == 0 &&
i.Metadata.Any(m => m.Value == "Never") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Equals(@"src\file2.cs")).Update.Should().Be(@"src\file2.cs");
contentItems.First(i =>
i.ConditionChain().Count() == 0 &&
i.Metadata.Any(m => m.Value == "Never") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Equals(@"src")).Update.Should().Be(@"src");
contentItems.First(i =>
i.ConditionChain().Count() == 0 &&
i.Metadata.Any(m => m.Value == "Never") &&
!string.IsNullOrEmpty(i.Update) &&
i.Update.Equals(@"rootfile.cs")).Update.Should().Be(@"rootfile.cs");
var configItems = contentItems.Where(i => i.ConditionChain().Count() == 1);
configItems.Should().HaveCount(2);
configItems.Should().HaveCount(3);
var configIncludeContentItem = contentItems.First(
item => item.ConditionChain().Count() > 0
&& item.Include.Contains("src"));
&& item.Update.Contains("src"));
var configRemoveContentItem = contentItems.First(
item => item.ConditionChain().Count() > 0
&& !string.IsNullOrEmpty(item.Remove));
configIncludeContentItem.Include.Should().Be("src");
configIncludeContentItem.Update.Should().Be("src");
configIncludeContentItem.GetMetadataWithName("Link").Should().NotBeNull();
configIncludeContentItem.GetMetadataWithName("Link").Value.Should().Be("/some/dir/%(FileName)%(Extension)");
configIncludeContentItem.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull();
configIncludeContentItem.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("PreserveNewest");
configIncludeContentItem.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("Never");
configRemoveContentItem.Remove.Should().Be("src");
configRemoveContentItem.Remove.Should().Be("src;rootfile.cs");
}
[Fact]
@ -477,47 +611,42 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}
}");
var contentItems = mockProj.Items.Where(item => item.ItemType == "Content");
var contentItems = mockProj.Items.Where(item => item.ItemType == "None");
contentItems.Count().Should().Be(5);
contentItems.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(3);
contentItems.Count().Should().Be(9);
contentItems.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(4);
var rootBuildOptionsContentItems = contentItems.Where(i => i.ConditionChain().Count() == 0).ToList();
rootBuildOptionsContentItems.Count().Should().Be(2);
rootBuildOptionsContentItems.Count().Should().Be(5);
foreach (var buildOptionContentItem in rootBuildOptionsContentItems)
{
buildOptionContentItem.GetMetadataWithName("Link").Should().BeNull();
buildOptionContentItem.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("PreserveNewest");
}
var configIncludeEncompassedItem = contentItems.FirstOrDefault(
item => item.ConditionChain().Count() > 0
&& item.Include == "root");
&& item.Update == "root");
configIncludeEncompassedItem.Should().BeNull();
var configIncludeContentItem = contentItems.First(
item => item.ConditionChain().Count() > 0
&& item.Include == "src");
&& item.Update == "src");
var configIncludeContentItem2 = contentItems.First(
item => item.ConditionChain().Count() > 0
&& item.Include.Contains(@"src\file3.cs"));
&& item.Update.Contains(@"src\file3.cs"));
var configRemoveContentItem = contentItems.First(
item => item.ConditionChain().Count() > 0
&& !string.IsNullOrEmpty(item.Remove));
configIncludeContentItem.Include.Should().Be("src");
configIncludeContentItem.Excludes().Should().BeEquivalentTo("src", "rootfile.cs", @"src\rootfile.cs", @"src\file2.cs");
configIncludeContentItem.Update.Should().Be("src");
configIncludeContentItem.GetMetadataWithName("Link").Should().NotBeNull();
configIncludeContentItem.GetMetadataWithName("Link").Value.Should().Be("/some/dir/%(FileName)%(Extension)");
configIncludeContentItem.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull();
configIncludeContentItem.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("PreserveNewest");
configIncludeContentItem2.Includes().Should().BeEquivalentTo(@"src\file3.cs");
configIncludeContentItem2.Exclude.Should().Be(@"src\file2.cs");
configIncludeContentItem.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("Never");
configIncludeContentItem2.Updates().Should().BeEquivalentTo(@"src\file3.cs");
configIncludeContentItem2.GetMetadataWithName("Link").Should().BeNull();
configIncludeContentItem2.GetMetadataWithName("CopyToOutputDirectory").Should().NotBeNull();
configIncludeContentItem2.GetMetadataWithName("CopyToOutputDirectory").Value.Should().Be("PreserveNewest");

View file

@ -15,7 +15,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
public class GivenThatIWantToMigratePackOptions : TestBase
{
[Fact]
public void It_does_not_migrate_Summary()
public void ItDoesNotMigrateSummary()
{
var mockProj = RunPackOptionsRuleOnPj(@"
{
@ -28,7 +28,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}
[Fact]
public void It_does_not_migrate_Owner()
public void ItDoesNotMigrateOwner()
{
var mockProj = RunPackOptionsRuleOnPj(@"
{
@ -41,7 +41,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}
[Fact]
public void Migrating__empty_tags_does_not_populate_PackageTags()
public void MigratingEmptyTagsDoesNotPopulatePackageTags()
{
var mockProj = RunPackOptionsRuleOnPj(@"
{
@ -54,7 +54,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}
[Fact]
public void Migrating_tags_populates_PackageTags_semicolon_delimited()
public void MigratingTagsPopulatesPackageTagsSemicolonDelimited()
{
var mockProj = RunPackOptionsRuleOnPj(@"
{
@ -68,7 +68,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}
[Fact]
public void Migrating_ReleaseNotes_populates_PackageReleaseNotes()
public void MigratingReleaseNotesPopulatesPackageReleaseNotes()
{
var mockProj = RunPackOptionsRuleOnPj(@"
{
@ -83,7 +83,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}
[Fact]
public void Migrating_IconUrl_populates_PackageIconUrl()
public void MigratingIconUrlPopulatesPackageIconUrl()
{
var mockProj = RunPackOptionsRuleOnPj(@"
{
@ -98,7 +98,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}
[Fact]
public void Migrating_ProjectUrl_populates_PackageProjectUrl()
public void MigratingProjectUrlPopulatesPackageProjectUrl()
{
var mockProj = RunPackOptionsRuleOnPj(@"
{
@ -113,7 +113,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}
[Fact]
public void Migrating_LicenseUrl_populates_PackageLicenseUrl()
public void MigratingLicenseUrlPopulatesPackageLicenseUrl()
{
var mockProj = RunPackOptionsRuleOnPj(@"
{
@ -128,7 +128,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}
[Fact]
public void Migrating_RequireLicenseAcceptance_populates_PackageRequireLicenseAcceptance()
public void MigratingRequireLicenseAcceptancePopulatesPackageRequireLicenseAcceptance()
{
var mockProj = RunPackOptionsRuleOnPj(@"
{
@ -142,7 +142,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}
[Fact]
public void Migrating_RequireLicenseAcceptance_populates_PackageRequireLicenseAcceptance_even_if_its_value_is_false()
public void MigratingRequireLicenseAcceptancePopulatesPackageRequireLicenseAcceptanceEvenIfItsValueIsFalse()
{
var mockProj = RunPackOptionsRuleOnPj(@"
{
@ -156,7 +156,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}
[Fact]
public void Migrating_Repository_Type_populates_RepositoryType()
public void MigratingRepositoryTypePopulatesRepositoryType()
{
var mockProj = RunPackOptionsRuleOnPj(@"
{
@ -172,7 +172,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}
[Fact]
public void Migrating_Repository_Url_populates_RepositoryUrl()
public void MigratingRepositoryUrlPopulatesRepositoryUrl()
{
var mockProj = RunPackOptionsRuleOnPj(@"
{
@ -188,7 +188,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}
[Fact]
public void Migrating_Files_without_mappings_populates_content_with_same_path_as_include_and_pack_true()
public void MigratingFilesWithoutMappingsPopulatesContentWithSamePathAsIncludeAndPackTrue()
{
var mockProj = RunPackOptionsRuleOnPj(@"
{
@ -200,15 +200,57 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}");
var contentItems = mockProj.Items
.Where(item => item.ItemType.Equals("Content", StringComparison.Ordinal))
.Where(item => item.ItemType.Equals("None", StringComparison.Ordinal))
.Where(item => item.GetMetadataWithName("Pack").Value == "true");
contentItems.Count().Should().Be(1);
contentItems.First().Include.Should().Be(@"path\to\some\file.cs;path\to\some\other\file.cs");
contentItems.First().Update.Should().Be(@"path\to\some\file.cs;path\to\some\other\file.cs");
}
[Fact]
public void Migrating_Files_with_mappings_populates_content_PackagePath_metadata()
public void MigratingFilesWithExcludePopulatesNoneWithPackFalseForTheExcludedFiles()
{
var mockProj = RunPackOptionsRuleOnPj(@"
{
""packOptions"": {
""files"": {
""include"": [""path/to/some/file.cs"", ""path/to/some/other/file.cs""],
""exclude"": [""path/to/file/to/exclude.cs""]
}
}
}");
foreach (var item in mockProj.Items.Where(i => i.ItemType.Equals("None", StringComparison.Ordinal)))
{
Console.WriteLine($"Update: {item.Update}, Include: {item.Include}, Remove: {item.Remove}");
foreach(var meta in item.Metadata)
{
Console.WriteLine($"\tMetadata: Name: {meta.Name}, Value: {meta.Value}");
}
foreach(var condition in item.ConditionChain())
{
Console.WriteLine($"\tCondition: {condition}");
}
}
var contentItemsToInclude = mockProj.Items
.Where(item => item.ItemType.Equals("None", StringComparison.Ordinal))
.Where(item => item.GetMetadataWithName("Pack").Value == "true");
contentItemsToInclude.Count().Should().Be(1);
contentItemsToInclude.First().Update.Should().Be(@"path\to\some\file.cs;path\to\some\other\file.cs");
var contentItemsToExclude = mockProj.Items
.Where(item => item.ItemType.Equals("None", StringComparison.Ordinal))
.Where(item => item.GetMetadataWithName("Pack").Value == "false");
contentItemsToExclude.Count().Should().Be(1);
contentItemsToExclude.First().Update.Should().Be(@"path\to\file\to\exclude.cs");
}
[Fact]
public void MigratingFilesWithMappingsPopulatesContentPackagePathMetadata()
{
var mockProj = RunPackOptionsRuleOnPj(@"
{
@ -223,19 +265,19 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}");
var contentItems = mockProj.Items
.Where(item => item.ItemType.Equals("Content", StringComparison.Ordinal))
.Where(item => item.ItemType.Equals("None", StringComparison.Ordinal))
.Where(item =>
item.GetMetadataWithName("Pack").Value == "true" &&
item.GetMetadataWithName("PackagePath") != null);
contentItems.Count().Should().Be(1);
contentItems.First().Include.Should().Be(@"path\to\some\file.cs");
contentItems.First().Update.Should().Be(@"path\to\some\file.cs");
contentItems.First().GetMetadataWithName("PackagePath").Value.Should().Be(
Path.Combine("some", "other", "path"));
}
[Fact]
public void Migrating_Files_with_mappings_to_root_populates_content_PackagePath_metadata_but_leaves_it_empty()
public void MigratingFilesWithMappingsToRootPopulatesContentPackagePathMetadataButLeavesItEmpty()
{
var mockProj = RunPackOptionsRuleOnPj(@"
{
@ -250,18 +292,18 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}");
var contentItems = mockProj.Items
.Where(item => item.ItemType.Equals("Content", StringComparison.Ordinal))
.Where(item => item.ItemType.Equals("None", StringComparison.Ordinal))
.Where(item =>
item.GetMetadataWithName("Pack").Value == "true" &&
item.GetMetadataWithName("PackagePath") != null);
contentItems.Count().Should().Be(1);
contentItems.First().Include.Should().Be(@"path\to\some\file.cs");
contentItems.First().Update.Should().Be(@"path\to\some\file.cs");
contentItems.First().GetMetadataWithName("PackagePath").Value.Should().BeEmpty();
}
[Fact]
public void Migrating_same_file_with_multiple_mappings_string_joins_the_mappings_in_PackagePath()
public void MigratingSameFileWithMultipleMappingsStringJoinsTheMappingsInPackagePath()
{
var mockProj = RunPackOptionsRuleOnPj(@"
{
@ -284,13 +326,13 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
});
var contentItems = mockProj.Items
.Where(item => item.ItemType.Equals("Content", StringComparison.Ordinal))
.Where(item => item.ItemType.Equals("None", StringComparison.Ordinal))
.Where(item =>
item.GetMetadataWithName("Pack").Value == "true" &&
item.GetMetadataWithName("PackagePath") != null);
contentItems.Count().Should().Be(1);
contentItems.First().Include.Should().Be(@"path\to\some\file.cs");
contentItems.First().Update.Should().Be(@"path\to\some\file.cs");
contentItems.First().GetMetadataWithName("PackagePath").Value.Should().Be(expectedPackagePath);
}

View file

@ -414,7 +414,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
mockProj.Items.Should().NotContain(
i => i.Include == "Microsoft.NETCore.App" && i.ItemType == "PackageReference");
mockProj.Properties.Should().ContainSingle(p => p.Name == "RuntimeFrameworkVersion").Which.Value.Should().Be("1.1.0");
mockProj.Properties.Should().ContainSingle(p => p.Name == "RuntimeFrameworkVersion").Which.Value.Should().Be("1.1.1");
}
[Fact]
@ -436,7 +436,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
mockProj.Items.Should().NotContain(
i => i.Include == "Microsoft.NETCore.App" && i.ItemType == "PackageReference");
var runtimeFrameworkVersion = mockProj.Properties.Should().ContainSingle(p => p.Name == "RuntimeFrameworkVersion").Which;
runtimeFrameworkVersion.Value.Should().Be("1.1.0");
runtimeFrameworkVersion.Value.Should().Be("1.1.1");
runtimeFrameworkVersion.Condition.Should().Contain("netcoreapp1.0");
}
@ -457,7 +457,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
mockProj.Items.Should().NotContain(
i => i.Include == "Microsoft.NETCore.App" && i.ItemType == "PackageReference");
var runtimeFrameworkVersion = mockProj.Properties.Should().ContainSingle(p => p.Name == "RuntimeFrameworkVersion").Which;
runtimeFrameworkVersion.Value.Should().Be("1.1.0");
runtimeFrameworkVersion.Value.Should().Be("1.1.1");
runtimeFrameworkVersion.Condition.Should().BeEmpty();
}

View file

@ -9,11 +9,13 @@ using System;
namespace Microsoft.DotNet.ProjectJsonMigration.Tests
{
public class GivenThatIWantToMigratePackagesToTheirLTSVersions : PackageDependenciesTestBase
public class GivenThatIWantToMigratePackagesToTheirLTSAndFTSVersions : PackageDependenciesTestBase
{
[Theory]
[InlineData("1.0.0", "1.0.3")]
[InlineData("1.0.3-preview2", "1.0.3")]
[InlineData("1.0.0", "1.0.4")]
[InlineData("1.0.3-preview2", "1.0.4")]
[InlineData("1.1.0", "1.1.1")]
[InlineData("1.1.1-preview2", "1.1.1")]
public void ItUpliftsMicrosoftNETCoreAppMetaPackages(
string sourceVersion,
string targetVersion)
@ -74,6 +76,25 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
[InlineData("Microsoft.AspNetCore.Routing.Abstractions", "1.0.0", "Microsoft.AspNetCore.Routing.Abstractions", ConstantPackageVersions.AspNetLTSPackagesVersion)]
[InlineData("Microsoft.AspNetCore.Server.Kestrel", "1.0.0", "Microsoft.AspNetCore.Server.Kestrel", ConstantPackageVersions.AspNetLTSPackagesVersion)]
[InlineData("Microsoft.AspNetCore.Server.Kestrel.Https", "1.0.0", "Microsoft.AspNetCore.Server.Kestrel.Https", ConstantPackageVersions.AspNetLTSPackagesVersion)]
[InlineData("Microsoft.AspNetCore.Antiforgery", "1.1.0", "Microsoft.AspNetCore.Antiforgery", "1.1.1")]
[InlineData("Microsoft.AspNetCore.Mvc", "1.1.0", "Microsoft.AspNetCore.Mvc", "1.1.2")]
[InlineData("Microsoft.AspNetCore.Mvc.Abstractions", "1.1.0", "Microsoft.AspNetCore.Mvc.Abstractions", "1.1.2")]
[InlineData("Microsoft.AspNetCore.Mvc.ApiExplorer", "1.1.0", "Microsoft.AspNetCore.Mvc.ApiExplorer", "1.1.2")]
[InlineData("Microsoft.AspNetCore.Mvc.Core", "1.1.0", "Microsoft.AspNetCore.Mvc.Core", "1.1.2")]
[InlineData("Microsoft.AspNetCore.Mvc.Cors", "1.1.0", "Microsoft.AspNetCore.Mvc.Cors", "1.1.2")]
[InlineData("Microsoft.AspNetCore.Mvc.DataAnnotations", "1.1.0", "Microsoft.AspNetCore.Mvc.DataAnnotations", "1.1.2")]
[InlineData("Microsoft.AspNetCore.Mvc.Formatters.Json", "1.1.0", "Microsoft.AspNetCore.Mvc.Formatters.Json", "1.1.2")]
[InlineData("Microsoft.AspNetCore.Mvc.Formatters.Xml", "1.1.0", "Microsoft.AspNetCore.Mvc.Formatters.Xml", "1.1.2")]
[InlineData("Microsoft.AspNetCore.Mvc.Localization", "1.1.0", "Microsoft.AspNetCore.Mvc.Localization", "1.1.2")]
[InlineData("Microsoft.AspNetCore.Mvc.Razor", "1.1.0", "Microsoft.AspNetCore.Mvc.Razor", "1.1.2")]
[InlineData("Microsoft.AspNetCore.Mvc.Razor.Host", "1.1.0", "Microsoft.AspNetCore.Mvc.Razor.Host", "1.1.2")]
[InlineData("Microsoft.AspNetCore.Mvc.TagHelpers", "1.1.0", "Microsoft.AspNetCore.Mvc.TagHelpers", "1.1.2")]
[InlineData("Microsoft.AspNetCore.Mvc.ViewFeatures", "1.1.0", "Microsoft.AspNetCore.Mvc.ViewFeatures", "1.1.2")]
[InlineData("Microsoft.AspNetCore.Mvc.WebApiCompatShim", "1.1.0", "Microsoft.AspNetCore.Mvc.WebApiCompatShim", "1.1.2")]
[InlineData("Microsoft.AspNetCore.Routing", "1.1.0", "Microsoft.AspNetCore.Routing", "1.1.1")]
[InlineData("Microsoft.AspNetCore.Routing.Abstractions", "1.1.0", "Microsoft.AspNetCore.Routing.Abstractions", "1.1.1")]
[InlineData("Microsoft.AspNetCore.Server.Kestrel", "1.1.0", "Microsoft.AspNetCore.Server.Kestrel", "1.1.1")]
[InlineData("Microsoft.AspNetCore.Server.Kestrel.Https", "1.1.0", "Microsoft.AspNetCore.Server.Kestrel.Https", "1.1.1")]
public void ItUpliftsAspNetCorePackages(
string sourcePackageName,
string sourceVersion,
@ -92,6 +113,14 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
[InlineData("Microsoft.EntityFrameworkCore.Sqlite.Design", "1.0.0", "Microsoft.EntityFrameworkCore.Sqlite.Design", ConstantPackageVersions.EntityFrameworkLTSPackagesVersion)]
[InlineData("Microsoft.EntityFrameworkCore.SqlServer", "1.0.0", "Microsoft.EntityFrameworkCore.SqlServer", ConstantPackageVersions.EntityFrameworkLTSPackagesVersion)]
[InlineData("Microsoft.EntityFrameworkCore.SqlServer.Design", "1.0.0", "Microsoft.EntityFrameworkCore.SqlServer.Design", ConstantPackageVersions.EntityFrameworkLTSPackagesVersion)]
[InlineData("Microsoft.EntityFrameworkCore", "1.1.0", "Microsoft.EntityFrameworkCore", "1.1.1")]
[InlineData("Microsoft.EntityFrameworkCore.InMemory", "1.1.0", "Microsoft.EntityFrameworkCore.InMemory", "1.1.1")]
[InlineData("Microsoft.EntityFrameworkCore.Relational", "1.1.0", "Microsoft.EntityFrameworkCore.Relational", "1.1.1")]
[InlineData("Microsoft.EntityFrameworkCore.Relational.Design", "1.1.0", "Microsoft.EntityFrameworkCore.Relational.Design", "1.1.1")]
[InlineData("Microsoft.EntityFrameworkCore.Sqlite", "1.1.0", "Microsoft.EntityFrameworkCore.Sqlite", "1.1.1")]
[InlineData("Microsoft.EntityFrameworkCore.Sqlite.Design", "1.1.0", "Microsoft.EntityFrameworkCore.Sqlite.Design", "1.1.1")]
[InlineData("Microsoft.EntityFrameworkCore.SqlServer", "1.1.0", "Microsoft.EntityFrameworkCore.SqlServer", "1.1.1")]
[InlineData("Microsoft.EntityFrameworkCore.SqlServer.Design", "1.1.0", "Microsoft.EntityFrameworkCore.SqlServer.Design", "1.1.1")]
public void ItUpliftsEntityFrameworkCorePackages(
string sourcePackageName,
string sourceVersion,
@ -228,11 +257,17 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}
[Theory]
[InlineData("Microsoft.Extensions.Logging", "1.0.0", "Microsoft.Extensions.Logging", "1.0.1")]
[InlineData("Microsoft.Extensions.Logging.Console", "1.0.0", "Microsoft.Extensions.Logging.Console", "1.0.1")]
[InlineData("Microsoft.Extensions.Logging.Debug", "1.0.0", "Microsoft.Extensions.Logging.Debug", "1.0.1")]
[InlineData("Microsoft.Extensions.Configuration.Json", "1.0.0", "Microsoft.Extensions.Configuration.Json", "1.0.1")]
[InlineData("Microsoft.Extensions.Configuration.UserSecrets", "1.0.0", "Microsoft.Extensions.Configuration.UserSecrets", "1.0.1")]
[InlineData("Microsoft.Extensions.Logging", "1.0.0", "Microsoft.Extensions.Logging", "1.0.2")]
[InlineData("Microsoft.Extensions.Logging.Console", "1.0.0", "Microsoft.Extensions.Logging.Console", "1.0.2")]
[InlineData("Microsoft.Extensions.Logging.Debug", "1.0.0", "Microsoft.Extensions.Logging.Debug", "1.0.2")]
[InlineData("Microsoft.Extensions.Configuration.Json", "1.0.0", "Microsoft.Extensions.Configuration.Json", "1.0.2")]
[InlineData("Microsoft.Extensions.Configuration.UserSecrets", "1.0.0", "Microsoft.Extensions.Configuration.UserSecrets", "1.0.2")]
[InlineData("Microsoft.Extensions.Logging", "1.1.0", "Microsoft.Extensions.Logging", "1.1.1")]
[InlineData("Microsoft.Extensions.Logging.Console", "1.1.0", "Microsoft.Extensions.Logging.Console", "1.1.1")]
[InlineData("Microsoft.Extensions.Logging.Debug", "1.1.0", "Microsoft.Extensions.Logging.Debug", "1.1.1")]
[InlineData("Microsoft.Extensions.Configuration.Json", "1.1.0", "Microsoft.Extensions.Configuration.Json", "1.1.1")]
[InlineData("Microsoft.Extensions.Configuration.UserSecrets", "1.1.0", "Microsoft.Extensions.Configuration.UserSecrets", "1.1.1")]
[InlineData("Microsoft.Extensions.Logging.AzureAppServices", "1.0.0-preview2", "Microsoft.Extensions.Logging.AzureAppServices", "1.0.1")]
public void ItUpliftsMicrosoftExtensionsPackages(
string sourcePackageName,
string sourceVersion,

View file

@ -32,24 +32,39 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}",
testDirectory: testDirectory);
mockProj.Items.Count(i => i.ItemType.Equals("Content", StringComparison.Ordinal)).Should().Be(2);
mockProj.Items.Count(i => i.ItemType.Equals("None", StringComparison.Ordinal)).Should().Be(4);
foreach (var item in mockProj.Items.Where(i => i.ItemType.Equals("Content", StringComparison.Ordinal)))
foreach (var item in mockProj.Items.Where(i => i.ItemType.Equals("None", StringComparison.Ordinal)))
{
item.Metadata.Count(m => m.Name == "CopyToPublishDirectory").Should().Be(1);
if (item.Include.Contains(@"src\file1.cs"))
if (item.Update.Contains(@"src\file1.cs"))
{
item.Include.Should().Be(@"src\file1.cs;src\file2.cs");
item.Exclude.Should().Be(@"src\file2.cs");
item.Update.Should().Be(@"src\file1.cs");
item.Exclude.Should().BeEmpty();
item.Metadata.Count(m =>
m.Name == "CopyToPublishDirectory" && m.Value == "PreserveNewest").Should().Be(1);
}
else if (item.Update.Contains(@"src\file2.cs"))
{
item.Update.Should().Be(@"src\file2.cs");
item.Exclude.Should().BeEmpty();
item.Metadata.Count(m =>
m.Name == "CopyToPublishDirectory" && m.Value == "Never").Should().Be(1);
}
else if (item.Update.Contains(@"root\**\*"))
{
item.Update.Should().Be(@"root\**\*");
item.Exclude.Should().BeEmpty();
item.Metadata.Count(m =>
m.Name == "CopyToPublishDirectory" && m.Value == "PreserveNewest").Should().Be(1);
}
else
{
item.Include.Should()
.Be(@"root\**\*;src\**\*;rootfile.cs");
item.Exclude.Should()
.Be(@"src\**\*;rootfile.cs;src\file2.cs");
item.Update.Should().Be(@"src\**\*;rootfile.cs");
item.Exclude.Should().BeEmpty();
item.Metadata.Count(m =>
m.Name == "CopyToPublishDirectory" && m.Value == "Never").Should().Be(1);
}
}
}
@ -82,21 +97,39 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}",
testDirectory: testDirectory);
mockProj.Items.Count(i => i.ItemType.Equals("Content", StringComparison.Ordinal)).Should().Be(2);
mockProj.Items.Count(i => i.ItemType.Equals("None", StringComparison.Ordinal)).Should().Be(4);
foreach (var item in mockProj.Items.Where(i => i.ItemType.Equals("Content", StringComparison.Ordinal)))
foreach (var item in mockProj.Items.Where(i => i.ItemType.Equals("None", StringComparison.Ordinal)))
{
item.Metadata.Count(m => m.Name == "CopyToPublishDirectory").Should().Be(1);
if (item.Update.Contains(@"src\file1.cs"))
{
item.Update.Should().Be(@"src\file1.cs;src\file2.cs");
item.Update.Should().Be(@"src\file1.cs");
item.Exclude.Should().BeEmpty();
item.Metadata.Count(m =>
m.Name == "CopyToPublishDirectory" && m.Value == "PreserveNewest").Should().Be(1);
}
else if (item.Update.Contains(@"src\file2.cs"))
{
item.Update.Should().Be(@"src\file2.cs");
item.Exclude.Should().BeEmpty();
item.Metadata.Count(m =>
m.Name == "CopyToPublishDirectory" && m.Value == "Never").Should().Be(1);
}
else if (item.Update.Contains(@"root\**\*"))
{
item.Update.Should().Be(@"root\**\*");
item.Exclude.Should().BeEmpty();
item.Metadata.Count(m =>
m.Name == "CopyToPublishDirectory" && m.Value == "PreserveNewest").Should().Be(1);
}
else
{
item.Update.Should().Be(@"root\**\*;src\**\*;rootfile.cs");
item.Update.Should().Be(@"src\**\*;rootfile.cs");
item.Exclude.Should().BeEmpty();
item.Metadata.Count(m =>
m.Name == "CopyToPublishDirectory" && m.Value == "Never").Should().Be(1);
}
}
}
@ -126,31 +159,46 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}",
testDirectory: testDirectory);
mockProj.Items.Count(i => i.ItemType.Equals("Content", StringComparison.Ordinal)).Should().Be(3);
mockProj.Items.Count(i => i.ItemType.Equals("None", StringComparison.Ordinal)).Should().Be(5);
// From ProjectReader #L725 (Both are empty)
var defaultIncludePatterns = Enumerable.Empty<string>();
var defaultExcludePatterns = Enumerable.Empty<string>();
foreach (var item in mockProj.Items.Where(i => i.ItemType.Equals("Content", StringComparison.Ordinal)))
foreach (var item in mockProj.Items.Where(i => i.ItemType.Equals("None", StringComparison.Ordinal)))
{
if (item.Include.Contains(@"root\**\*"))
if (item.Update.Contains(@"root\**\*"))
{
item.Include.Should().Be(@"root\**\*");
item.Exclude.Should().Be(@"src\**\*;rootfile.cs;src\file3.cs");
item.Update.Should().Be(@"root\**\*");
item.Metadata.Count(m =>
m.Name == "CopyToPublishDirectory" && m.Value == "PreserveNewest").Should().Be(1);
}
else if (item.Include.Contains(@"src\file1.cs"))
else if (item.Update.Contains(@"src\file1.cs"))
{
item.Include.Should().Be(@"src\file1.cs;src\file2.cs");
item.Exclude.Should().Be(@"src\file2.cs;src\file3.cs");
item.Update.Should().Be(@"src\file1.cs");
item.Metadata.Count(m =>
m.Name == "CopyToOutputDirectory" && m.Value == "PreserveNewest").Should().Be(1);
item.Metadata.Count(m =>
m.Name == "CopyToPublishDirectory" && m.Value == "PreserveNewest").Should().Be(1);
}
else if (item.Update.Contains(@"src\file2.cs"))
{
item.Update.Should().Be(@"src\file2.cs");
item.Metadata.Count(m =>
m.Name == "CopyToOutputDirectory" && m.Value == "Never").Should().Be(1);
item.Metadata.Count(m =>
m.Name == "CopyToPublishDirectory" && m.Value == "PreserveNewest").Should().Be(1);
}
else if (item.Update.Contains(@"src\file3.cs"))
{
item.Update.Should().Be(@"src\file3.cs");
item.Metadata.Count(m =>
m.Name == "CopyToPublishDirectory" && m.Value == "Never").Should().Be(1);
}
else
{
item.Include.Should()
item.Update.Should()
.Be(@"src\**\*;rootfile.cs");
item.Exclude.Should()
.Be(@"src\**\*;rootfile.cs;src\file2.cs;src\file3.cs");
item.Metadata.Count(m =>
m.Name == "CopyToOutputDirectory" && m.Value == "Never").Should().Be(1);
item.Metadata.Count(m =>
m.Name == "CopyToPublishDirectory" && m.Value == "Never").Should().Be(1);
}
}
}
@ -189,35 +237,84 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}",
testDirectory: testDirectory);
mockProj.Items.Count(i => i.ItemType.Equals("Content", StringComparison.Ordinal)).Should().Be(4);
mockProj.Items.Count(i => i.ItemType.Equals("None", StringComparison.Ordinal)).Should().Be(5);
// From ProjectReader #L725 (Both are empty)
var defaultIncludePatterns = Enumerable.Empty<string>();
var defaultExcludePatterns = Enumerable.Empty<string>();
foreach (var item in mockProj.Items.Where(i => i.ItemType.Equals("Content", StringComparison.Ordinal)))
foreach (var item in mockProj.Items.Where(i => i.ItemType.Equals("None", StringComparison.Ordinal)))
{
var metadata = string.Join(",", item.Metadata.Select(m => m.Name));
Console.WriteLine($"LICAVALC: Update: {item.Update}, Include: {item.Include}, Metadata: {metadata}");
if (item.Update.Contains(@"root\**\*"))
{
item.Update.Should().Be(@"root\**\*;src\**\*;rootfile.cs");
item.Update.Should().Be(@"root\**\*");
item.Exclude.Should().BeEmpty();
item.Metadata.Count(m =>
m.Name == "CopyToPublishDirectory" && m.Value == "PreserveNewest").Should().Be(1);
}
else if (item.Update.Contains(@"src\file1.cs"))
{
item.Update.Should().Be(@"src\file1.cs;src\file2.cs");
item.Update.Should().Be(@"src\file1.cs");
item.Exclude.Should().BeEmpty();
item.Metadata.Count(m =>
m.Name == "CopyToOutputDirectory" && m.Value == "PreserveNewest").Should().Be(1);
item.Metadata.Count(m =>
m.Name == "CopyToPublishDirectory" && m.Value == "PreserveNewest").Should().Be(1);
}
else if (item.Update.Contains(@"src\file2.cs"))
{
item.Update.Should().Be(@"src\file2.cs");
item.Exclude.Should().BeEmpty();
item.Metadata.Count(m =>
m.Name == "CopyToOutputDirectory" && m.Value == "Never").Should().Be(1);
item.Metadata.Count(m =>
m.Name == "CopyToPublishDirectory" && m.Value == "PreserveNewest").Should().Be(1);
}
else if (item.Update.Contains(@"src\file3.cs"))
{
item.Update.Should().Be(@"src\file3.cs");
item.Exclude.Should().BeEmpty();
item.Metadata.Count(m =>
m.Name == "CopyToPublishDirectory" && m.Value == "Never").Should().Be(1);
}
else
{
item.Update.Should().Be(@"src\**\*;rootfile.cs");
item.Exclude.Should().BeEmpty();
item.Metadata.Count(m =>
m.Name == "CopyToOutputDirectory" && m.Value == "Never").Should().Be(1);
item.Metadata.Count(m =>
m.Name == "CopyToPublishDirectory" && m.Value == "Never").Should().Be(1);
}
}
}
[Fact]
public void ExcludedPatternsAreNotEmittedOnNoneWhenBuildingAWebProject()
{
var mockProj = RunPublishOptionsRuleOnPj(@"
{
""buildOptions"": {
""emitEntryPoint"": true
},
""publishOptions"": {
""include"": [""wwwroot"", ""**/*.cshtml"", ""appsettings.json"", ""web.config""],
},
""dependencies"": {
""Microsoft.AspNetCore.Mvc"" : {
""version"": ""1.0.0""
}
},
""frameworks"": {
""netcoreapp1.0"": {}
}
}");
mockProj.Items.Count(i => i.ItemType.Equals("None", StringComparison.Ordinal)).Should().Be(0);
}
private void WriteFilesInProjectDirectory(string testDirectory)
{
Directory.CreateDirectory(Path.Combine(testDirectory, "root"));

View file

@ -69,7 +69,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}
[Fact]
public void MigratingCoreAndDesktopTFMsAddsAllRuntimeIdentifiersIfTheProjectDoesNothaveAnyAlready()
public void MigratingCoreAndDesktopTFMsDoesNoAddRuntimeIdentifiersOrRuntimeIdentifierWhenTheProjectDoesNothaveAnyAlready()
{
var testDirectory = Temp.CreateDirectory().Path;
var testPJ = new ProjectJsonBuilder(TestAssets)
@ -88,35 +88,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
new MigrateTFMRule().Apply(migrationSettings, migrationInputs);
mockProj.Properties.Count(p => p.Name == "RuntimeIdentifiers").Should().Be(1);
mockProj.Properties.First(p => p.Name == "RuntimeIdentifiers")
.Value.Should().Be("win7-x64;win7-x86;osx.10.10-x64;osx.10.11-x64;ubuntu.14.04-x64;ubuntu.16.04-x64;centos.7-x64;rhel.7.2-x64;debian.8-x64;fedora.23-x64;opensuse.13.2-x64");
}
[Fact]
public void MigratingCoreAndDesktopTFMsAddsRuntimeIdentifierWithWin7x86ConditionOnAllFullFrameworksWhenNoRuntimesExistAlready()
{
var testDirectory = Temp.CreateDirectory().Path;
var testPJ = new ProjectJsonBuilder(TestAssets)
.FromTestAssetBase("PJAppWithMultipleFrameworks")
.SaveToDisk(testDirectory);
var projectContexts = ProjectContext.CreateContextForEachFramework(testDirectory);
var mockProj = ProjectRootElement.Create();
var migrationSettings = MigrationSettings.CreateMigrationSettingsTestHook(testDirectory, testDirectory, mockProj);
var migrationInputs = new MigrationRuleInputs(
projectContexts,
mockProj,
mockProj.AddItemGroup(),
mockProj.AddPropertyGroup());
new MigrateTFMRule().Apply(migrationSettings, migrationInputs);
mockProj.Properties.Count(p => p.Name == "RuntimeIdentifier").Should().Be(1);
var runtimeIdentifier = mockProj.Properties.First(p => p.Name == "RuntimeIdentifier");
runtimeIdentifier.Value.Should().Be("win7-x86");
runtimeIdentifier.Condition.Should().Be(" '$(TargetFramework)' == 'net20' OR '$(TargetFramework)' == 'net35' OR '$(TargetFramework)' == 'net40' OR '$(TargetFramework)' == 'net461' ");
mockProj.Properties.Count(p => p.Name == "RuntimeIdentifiers").Should().Be(0);
mockProj.Properties.Count(p => p.Name == "RuntimeIdentifier").Should().Be(0);
}
[Fact]
@ -144,7 +117,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}
[Fact]
public void MigratingProjectWithFullFrameworkTFMsOnlyAddsARuntimeIdentifierWin7x86WhenNoRuntimesExistAlready()
public void MigratingProjectWithFullFrameworkTFMsDoesNotAddRuntimeIdentifiersOrRuntimeIdentiferWhenNoRuntimesExistAlready()
{
var testDirectory = Temp.CreateDirectory().Path;
var testPJ = new ProjectJsonBuilder(TestAssets)
@ -165,8 +138,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
new MigrateTFMRule().Apply(migrationSettings, migrationInputs);
mockProj.Properties.Count(p => p.Name == "RuntimeIdentifiers").Should().Be(0);
mockProj.Properties.Where(p => p.Name == "RuntimeIdentifier").Should().HaveCount(1);
mockProj.Properties.Single(p => p.Name == "RuntimeIdentifier").Value.Should().Be("win7-x86");
mockProj.Properties.Where(p => p.Name == "RuntimeIdentifier").Should().HaveCount(0);
}
[Fact]

View file

@ -19,6 +19,10 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
[InlineData("Microsoft.VisualStudio.Web.CodeGenerators.Mvc", "1.0.0-preview3-final", "Microsoft.VisualStudio.Web.CodeGeneration.Design", ConstantPackageVersions.AspNetToolsVersion)]
[InlineData("Microsoft.VisualStudio.Web.CodeGenerators.Mvc", "1.1.0-preview4-final", "Microsoft.VisualStudio.Web.CodeGeneration.Design", ConstantPackageVersions.AspNet110ToolsVersion)]
[InlineData("Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Design", "1.1.0-preview4-final", "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation", ConstantPackageVersions.AspNet110ToolsVersion)]
[InlineData("Microsoft.VisualStudio.Web.BrowserLink.Loader", "14.0.0-preview2-final", "Microsoft.VisualStudio.Web.BrowserLink", "1.0.1")]
[InlineData("Microsoft.VisualStudio.Web.BrowserLink.Loader", "14.0.0-*", "Microsoft.VisualStudio.Web.BrowserLink", "1.0.1")]
[InlineData("Microsoft.VisualStudio.Web.BrowserLink.Loader", "14.0.1", "Microsoft.VisualStudio.Web.BrowserLink", "1.0.1")]
[InlineData("Microsoft.VisualStudio.Web.BrowserLink.Loader", "14.1.0-preview4-final", "Microsoft.VisualStudio.Web.BrowserLink", "1.1.0")]
public void ItMigratesProjectDependenciesToANewNameAndVersion(
string sourceToolName,
string sourceVersion,

View file

@ -0,0 +1,27 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Microsoft.DotNet.PlatformAbstractions;
namespace Microsoft.DotNet.Tools.Test.Utilities
{
public static class EnvironmentInfo
{
public static bool HasSharedFramework(string framework)
{
if (framework == "netcoreapp1.0")
{
string rid = RuntimeEnvironment.GetRuntimeIdentifier();
switch (rid)
{
case "fedora.24-x64":
case "opensuse.42.1-x64":
case "ubuntu.16.10-x64":
return false;
}
}
return true;
}
}
}

View file

@ -0,0 +1,18 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Xunit;
namespace Microsoft.DotNet.Tools.Test.Utilities
{
public class RequiresSpecificFrameworkFactAttribute : FactAttribute
{
public RequiresSpecificFrameworkFactAttribute(string framework)
{
if (!EnvironmentInfo.HasSharedFramework(framework))
{
this.Skip = $"This test requires a shared framework that isn't present: {framework}";
}
}
}
}

View file

@ -19,6 +19,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
{
protected const string DefaultFramework = "netcoreapp1.0";
protected const string DefaultLibraryFramework = "netstandard1.5";
protected const string ConsoleLoggerOutputNormal = "--logger:console;verbosity=normal";
private TempRoot _temp;
private static TestAssets s_testAssets;

View file

@ -28,7 +28,7 @@ namespace Microsoft.DotNet.Cli.Build.Tests
var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";
var outputDll = testInstance.Root.GetDirectory("bin", configuration, "netcoreapp1.0")
var outputDll = testInstance.Root.GetDirectory("bin", configuration, "netcoreapp1.1")
.GetFile($"{testAppName}.dll");
var outputRunCommand = new TestCommand("dotnet");
@ -46,7 +46,7 @@ namespace Microsoft.DotNet.Cli.Build.Tests
string dir = "pkgs";
string args = $"--packages {dir}";
string newArgs = $"console -o \"{rootPath}\" --debug:ephemeral-hive";
string newArgs = $"console -f netcoreapp1.1 -o \"{rootPath}\" --debug:ephemeral-hive";
new NewCommandShim()
.WithWorkingDirectory(rootPath)
.Execute(newArgs)
@ -65,7 +65,12 @@ namespace Microsoft.DotNet.Cli.Build.Tests
.Execute()
.Should().Pass();
var outputDll = Directory.EnumerateFiles(Path.Combine(rootPath, "bin"), "*.dll", SearchOption.AllDirectories).Single();
var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";
var outputDll = Directory.EnumerateFiles(
Path.Combine(rootPath, "bin", configuration, "netcoreapp1.1"), "*.dll",
SearchOption.TopDirectoryOnly)
.Single();
var outputRunCommand = new TestCommand("dotnet");

View file

@ -0,0 +1,127 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Microsoft.Build.Construction;
using Microsoft.DotNet.TestFramework;
using Microsoft.DotNet.Tools.Common;
using Microsoft.DotNet.Tools.Test.Utilities;
using System;
using System.Collections.Generic;
using System.Linq;
using Xunit;
using FluentAssertions;
using System.IO;
using Microsoft.DotNet.Tools.Migrate;
using BuildCommand = Microsoft.DotNet.Tools.Test.Utilities.BuildCommand;
using System.Runtime.Loader;
using Newtonsoft.Json.Linq;
using MigrateCommand = Microsoft.DotNet.Tools.Migrate.MigrateCommand;
namespace Microsoft.DotNet.Migration.Tests
{
public class GivenThatIWantMigratedAppsToBinplaceContent : TestBase
{
[Fact(Skip="Unblocking CI")]
public void ItBinplacesContentOnBuildForConsoleApps()
{
var projectDirectory = TestAssets
.GetProjectJson("TestAppWithContents")
.CreateInstance()
.WithSourceFiles()
.WithRestoreFiles()
.WithEmptyGlobalJson()
.Root;
new TestCommand("dotnet")
.WithForwardingToConsole()
.Execute($"migrate {projectDirectory.FullName}")
.Should()
.Pass();
var command = new RestoreCommand()
.WithWorkingDirectory(projectDirectory)
.Execute()
.Should()
.Pass();
var result = new BuildCommand()
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput()
.Should()
.Pass();
var outputDir = projectDirectory.GetDirectory("bin", "Debug", "netcoreapp1.0");
outputDir.Should().Exist().And.HaveFile("testcontentfile.txt");
outputDir.GetDirectory("dir").Should().Exist().And.HaveFile("mappingfile.txt");
}
[Fact(Skip="Unblocking CI")]
public void ItBinplacesContentOnPublishForConsoleApps()
{
var projectDirectory = TestAssets
.GetProjectJson("TestAppWithContents")
.CreateInstance()
.WithSourceFiles()
.WithRestoreFiles()
.WithEmptyGlobalJson()
.Root;
new TestCommand("dotnet")
.WithForwardingToConsole()
.Execute($"migrate {projectDirectory.FullName}")
.Should()
.Pass();
var command = new RestoreCommand()
.WithWorkingDirectory(projectDirectory)
.Execute()
.Should()
.Pass();
var result = new PublishCommand()
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput()
.Should()
.Pass();
var publishDir = projectDirectory.GetDirectory("bin", "Debug", "netcoreapp1.0", "publish");
publishDir.Should().Exist().And.HaveFile("testcontentfile.txt");
publishDir.GetDirectory("dir").Should().Exist().And.HaveFile("mappingfile.txt");
}
[Fact(Skip="CI does not have NPM, which is required for the publish of this app.")]
public void ItBinplacesContentOnPublishForWebApps()
{
var projectDirectory = TestAssets
.GetProjectJson("ProjectJsonWebTemplate")
.CreateInstance()
.WithSourceFiles()
.WithRestoreFiles()
.WithEmptyGlobalJson()
.Root;
new TestCommand("dotnet")
.WithForwardingToConsole()
.Execute($"migrate {projectDirectory.FullName}")
.Should()
.Pass();
var command = new RestoreCommand()
.WithWorkingDirectory(projectDirectory)
.Execute()
.Should()
.Pass();
var result = new PublishCommand()
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput()
.Should()
.Pass();
var publishDir = projectDirectory.GetDirectory("bin", "Debug", "netcoreapp1.0", "publish");
publishDir.Should().Exist().And.HaveFile("README.md");
publishDir.GetDirectory("wwwroot").Should().Exist();
}
}
}

View file

@ -0,0 +1,62 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Microsoft.Build.Construction;
using Microsoft.DotNet.TestFramework;
using Microsoft.DotNet.Tools.Common;
using Microsoft.DotNet.Tools.Test.Utilities;
using System;
using System.Collections.Generic;
using System.Linq;
using Xunit;
using FluentAssertions;
using System.IO;
using System.IO.Compression;
using Microsoft.DotNet.Tools.Migrate;
using BuildCommand = Microsoft.DotNet.Tools.Test.Utilities.BuildCommand;
using System.Runtime.Loader;
using Newtonsoft.Json.Linq;
using MigrateCommand = Microsoft.DotNet.Tools.Migrate.MigrateCommand;
namespace Microsoft.DotNet.Migration.Tests
{
public class GivenThatIWantMigratedAppsToPackContent : TestBase
{
[Fact(Skip="Unblocking CI")]
public void ItPacksContentForLibraries()
{
var projectDirectory = TestAssets
.GetProjectJson("PJTestLibraryWithConfiguration")
.CreateInstance()
.WithSourceFiles()
.WithRestoreFiles()
.WithEmptyGlobalJson()
.Root;
new TestCommand("dotnet")
.WithForwardingToConsole()
.Execute($"migrate {projectDirectory.FullName}")
.Should()
.Pass();
var command = new RestoreCommand()
.WithWorkingDirectory(projectDirectory)
.Execute()
.Should()
.Pass();
var result = new PackCommand()
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput()
.Should()
.Pass();
using (var archive = ZipFile.OpenRead(
Path.Combine(projectDirectory.FullName, "bin", "debug", "PJTestLibraryWithConfiguration.1.0.0.nupkg")))
{
archive.Entries.Select(e => e.FullName).Should().Contain("dir/contentitem.txt");
}
}
}
}

View file

@ -224,10 +224,10 @@ namespace Microsoft.DotNet.Migration.Tests
outputDir.Should().Exist()
.And.HaveFiles(new[]
{
"ContentFile1.txt",
"ContentFile2.txt",
"ContentFileBuiltIn1.txt",
"ContentFileBuiltIn2.txt",
"ContentFile1.txt1",
"ContentFile2.txt1",
"ContentFileBuiltIn1.txt1",
"ContentFileBuiltIn2.txt1",
"IncludeThis.txt",
});
Directory.Exists(Path.Combine(outputDir.FullName, "ExcludeThis1.txt")).Should().BeFalse();
@ -237,10 +237,10 @@ namespace Microsoft.DotNet.Migration.Tests
publishDir.Should().Exist()
.And.HaveFiles(new[]
{
"ContentFile1.txt",
"ContentFile2.txt",
"ContentFileBuiltIn1.txt",
"ContentFileBuiltIn2.txt",
"ContentFile1.txt1",
"ContentFile2.txt1",
"ContentFileBuiltIn1.txt1",
"ContentFileBuiltIn2.txt1",
"IncludeThis.txt",
});
Directory.Exists(Path.Combine(publishDir.FullName, "ExcludeThis1.txt")).Should().BeFalse();
@ -431,6 +431,12 @@ namespace Microsoft.DotNet.Migration.Tests
.Execute("build -c Debug")
.Should().Pass();
if (!EnvironmentInfo.HasSharedFramework("netcoreapp1.0"))
{
// running the app requires netcoreapp1.0
return;
}
var cmd = new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput("run -c Debug");
@ -483,6 +489,12 @@ namespace Microsoft.DotNet.Migration.Tests
.Execute("build -c Debug")
.Should().Pass();
if (!EnvironmentInfo.HasSharedFramework("netcoreapp1.0"))
{
// running the app requires netcoreapp1.0
return;
}
var cmd = new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput("run -c Debug");
@ -534,6 +546,12 @@ namespace Microsoft.DotNet.Migration.Tests
.Execute("build -c Debug")
.Should().Pass();
if (!EnvironmentInfo.HasSharedFramework("netcoreapp1.0"))
{
// running the app requires netcoreapp1.0
return;
}
var cmd = new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput("run -c Debug");

View file

@ -95,7 +95,7 @@ namespace Microsoft.DotNet.Migration.Tests
{
MigrateAndBuild(
"NonRestoredTestProjects",
"PJAppWithSlnAndXprojRefThatRefsCsprojWhereSlnDoesNotRefCsproj");
"PJAppWithSlnThatDoesNotRefCsproj");
}
[Fact]
@ -229,11 +229,10 @@ namespace Microsoft.DotNet.Migration.Tests
.Execute($"restore \"{solutionRelPath}\"")
.Should().Pass();
//ISSUE: https://github.com/dotnet/cli/issues/5205
//new DotnetCommand()
// .WithWorkingDirectory(projectDirectory)
// .Execute($"build \"{solutionRelPath}\"")
// .Should().Pass();
new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.Execute($"build \"{solutionRelPath}\"")
.Should().Pass();
}
private void MigrateAndBuild(string groupName, string projectName, [CallerMemberName] string callingMethod = "", string identifier = "")
@ -257,11 +256,10 @@ namespace Microsoft.DotNet.Migration.Tests
.Execute($"restore \"{solutionRelPath}\"")
.Should().Pass();
//ISSUE: https://github.com/dotnet/cli/issues/5205
//new DotnetCommand()
// .WithWorkingDirectory(projectDirectory)
// .Execute($"build \"{solutionRelPath}\"")
// .Should().Pass();
new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.Execute($"build \"{solutionRelPath}\"")
.Should().Pass();
SlnFile slnFile = SlnFile.Read(Path.Combine(projectDirectory.FullName, solutionRelPath));

View file

@ -492,7 +492,7 @@ namespace Microsoft.DotNet.Migration.Tests
}
outputsIdentical.Should().BeTrue();
VerifyAllMSBuildOutputsRunnable(projectDirectory);
}
@ -543,7 +543,7 @@ namespace Microsoft.DotNet.Migration.Tests
.And.Contain("Migration failed.");
}
[Fact]
[RequiresSpecificFrameworkFact("netcoreapp1.0")]
public void ItMigratesAndPublishesProjectsWithRuntimes()
{
var projectName = "PJTestAppSimple";
@ -745,6 +745,12 @@ namespace Microsoft.DotNet.Migration.Tests
private void VerifyAllMSBuildOutputsRunnable(DirectoryInfo projectDirectory)
{
if (!EnvironmentInfo.HasSharedFramework("netcoreapp1.0"))
{
// running the apps requires netcoreapp1.0
return;
}
var dllFileName = Path.GetFileName(projectDirectory.FullName) + ".dll";
var runnableDlls = projectDirectory

View file

@ -8,5 +8,6 @@
<add key="aspnet101" value="https://www.myget.org/F/aspnet101/api/v3/index.json" />
<add key="dotnet-web" value="https://dotnet.myget.org/F/dotnet-web/api/v3/index.json" />
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="AspNetCurrent" value="https://dotnet.myget.org/F/aspnet-feb2017-patch/api/v3/index.json" />
</packageSources>
</configuration>

View file

@ -7,5 +7,6 @@
<add key="aspnet101" value="https://www.myget.org/F/aspnet101/api/v3/index.json" />
<add key="dotnet-web" value="https://dotnet.myget.org/F/dotnet-web/api/v3/index.json" />
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="AspNetCurrent" value="https://dotnet.myget.org/F/aspnet-feb2017-patch/api/v3/index.json" />
</packageSources>
</configuration>

View file

@ -32,11 +32,11 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
new PublishCommand()
.WithWorkingDirectory(testProjectDirectory)
.Execute("--framework netcoreapp1.0")
.Execute("--framework netcoreapp1.1")
.Should().Pass();
var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";
var outputDll = Path.Combine(testProjectDirectory, "bin", configuration, "netcoreapp1.0", "publish", $"{testAppName}.dll");
var outputDll = Path.Combine(testProjectDirectory, "bin", configuration, "netcoreapp1.1", "publish", $"{testAppName}.dll");
new TestCommand("dotnet")
.ExecuteWithCapturedOutput(outputDll)
@ -59,7 +59,7 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
var rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier();
new PublishCommand()
.WithFramework("netcoreapp1.0")
.WithFramework("netcoreapp1.1")
.WithRuntime(rid)
.WithWorkingDirectory(testProjectDirectory)
//Workaround for https://github.com/dotnet/cli/issues/4501
@ -70,7 +70,7 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
var configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";
var outputProgram = testProjectDirectory
.GetDirectory("bin", configuration, "netcoreapp1.0", rid, "publish", $"{testAppName}{Constants.ExeSuffix}")
.GetDirectory("bin", configuration, "netcoreapp1.1", rid, "publish", $"{testAppName}{Constants.ExeSuffix}")
.FullName;
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
@ -94,7 +94,7 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
string dir = "pkgs";
string args = $"--packages {dir}";
string newArgs = $"console -o \"{rootPath}\"";
string newArgs = $"console -f netcoreapp1.1 -o \"{rootPath}\"";
new NewCommandShim()
.WithWorkingDirectory(rootPath)
.Execute(newArgs)

View file

@ -75,7 +75,7 @@ namespace Microsoft.DotNet.Cli.Run.Tests
new RunCommand()
.WithWorkingDirectory(testProjectDirectory)
.ExecuteWithCapturedOutput("--framework netcoreapp1.0")
.ExecuteWithCapturedOutput("--framework netcoreapp1.1")
.Should().Pass()
.And.HaveStdOutContaining("Hello World!");
}
@ -126,7 +126,7 @@ namespace Microsoft.DotNet.Cli.Run.Tests
string dir = "pkgs";
string args = $"--packages {dir}";
string newArgs = $"console -o \"{rootPath}\"";
string newArgs = $"console -f netcoreapp1.1 -o \"{rootPath}\"";
new NewCommandShim()
.WithWorkingDirectory(rootPath)
.Execute(newArgs)

View file

@ -465,11 +465,10 @@ EndGlobal
cmd.StdErr.Should().BeEmpty();
}
//ISSUE: https://github.com/dotnet/cli/issues/5205
//[Theory]
//[InlineData("TestAppWithSlnAndCsprojFiles")]
//[InlineData("TestAppWithSlnAndCsprojProjectGuidFiles")]
//[InlineData("TestAppWithEmptySln")]
[Theory]
[InlineData("TestAppWithSlnAndCsprojFiles")]
[InlineData("TestAppWithSlnAndCsprojProjectGuidFiles")]
[InlineData("TestAppWithEmptySln")]
public void WhenValidProjectIsPassedTheSlnBuilds(string testAsset)
{
var projectDirectory = TestAssets

View file

@ -32,7 +32,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests
var result = new DotnetTestCommand()
.WithWorkingDirectory(testProjectDirectory)
.WithRuntime(runtime)
.ExecuteWithCapturedOutput();
.ExecuteWithCapturedOutput(TestBase.ConsoleLoggerOutputNormal);
result.StdOut
.Should().Contain("Total tests: 3. Passed: 2. Failed: 1. Skipped: 0.", "because .NET 4.6 tests will pass")
@ -63,7 +63,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests
// Call test
CommandResult result = new DotnetTestCommand()
.WithWorkingDirectory(testProjectDirectory)
.ExecuteWithCapturedOutput();
.ExecuteWithCapturedOutput(TestBase.ConsoleLoggerOutputNormal);
// Verify
// for target framework net46

View file

@ -34,7 +34,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests
// Call test
CommandResult result = new DotnetTestCommand()
.WithWorkingDirectory(testProjectDirectory)
.ExecuteWithCapturedOutput();
.ExecuteWithCapturedOutput(TestBase.ConsoleLoggerOutputNormal);
// Verify
result.StdOut.Should().Contain("Total tests: 2. Passed: 1. Failed: 1. Skipped: 0.");
@ -64,7 +64,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests
// Call test
CommandResult result = new DotnetTestCommand()
.WithWorkingDirectory(testProjectDirectory)
.ExecuteWithCapturedOutput();
.ExecuteWithCapturedOutput(TestBase.ConsoleLoggerOutputNormal);
// Verify
result.StdOut.Should().Contain("Total tests: 2. Passed: 1. Failed: 1. Skipped: 0.");
@ -93,7 +93,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests
string configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";
string expectedError = Path.Combine(testProjectDirectory, "bin",
configuration, "netcoreapp1.0", "VSTestDotNetCore.dll");
configuration, "netcoreapp1.1", "VSTestDotNetCore.dll");
expectedError = "The test source file " + "\"" + expectedError + "\"" + " provided was not found.";
// Call test
@ -215,7 +215,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests
CommandResult result = new DotnetTestCommand()
.WithWorkingDirectory(rootPath)
.ExecuteWithCapturedOutput();
.ExecuteWithCapturedOutput(TestBase.ConsoleLoggerOutputNormal);
result.StdOut.Should().Contain("Total tests: 2. Passed: 1. Failed: 1. Skipped: 0.");
result.StdOut.Should().Contain("Passed TestNamespace.VSTestTests.VSTestPassTest");

View file

@ -31,10 +31,10 @@ namespace Microsoft.DotNet.Cli.VSTest.Tests
.Should().Pass();
var outputDll = testRoot
.GetDirectory("bin", configuration, "netcoreapp1.0")
.GetDirectory("bin", configuration, "netcoreapp1.1")
.GetFile($"{testAppName}.dll");
var argsForVstest = $"\"{outputDll.FullName}\"";
var argsForVstest = $"\"{outputDll.FullName}\" {TestBase.ConsoleLoggerOutputNormal}";
// Call vstest
var result = new VSTestCommand().ExecuteWithCapturedOutput(argsForVstest);

View file

@ -120,7 +120,7 @@ namespace Microsoft.DotNet.Tests
.WithSourceFiles()
.WithRestoreFiles();
const string framework = ".NETCoreApp,Version=v1.0";
const string framework = ".NETCoreApp,Version=v1.1";
new BuildCommand()
.WithProjectDirectory(testInstance.Root)
@ -296,7 +296,7 @@ namespace Microsoft.DotNet.Tests
.WithRestoreFiles();
var assetsFile = new DirectoryInfo(new RepoDirectoriesProvider().NugetPackages)
.GetDirectory(".tools", "dotnet-portable", "1.0.0", "netcoreapp1.0")
.GetDirectory(".tools", "dotnet-portable", "1.0.0", "netcoreapp1.1")
.GetFile("project.assets.json");
var stopWatch = Stopwatch.StartNew();
@ -326,7 +326,7 @@ namespace Microsoft.DotNet.Tests
.WithRestoreFiles();
var assetsFile = new DirectoryInfo(new RepoDirectoriesProvider().NugetPackages)
.GetDirectory(".tools", "dotnet-portable", "1.0.0", "netcoreapp1.0")
.GetDirectory(".tools", "dotnet-portable", "1.0.0", "netcoreapp1.1")
.GetFile("project.assets.json");
var stopWatch = Stopwatch.StartNew();