Emitting PackageId whenever we emit AssemblyName. We need to do this to preserve the behavior from PJ where the package id matched the containing PJ folder name. In MSBuild, PackageId will match AssemblyName, unless it is explicitly specified. (#4990)

This commit is contained in:
Livar 2016-12-09 16:10:16 -08:00 committed by Piotr Puszkiewicz
parent 8eaec8715b
commit bd590f51e6
4 changed files with 79 additions and 3 deletions

View file

@ -84,6 +84,36 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
mockProj.Items.Count().Should().Be(0);
}
public void MigratingOutputNamePopulatesAssemblyName()
{
var mockProj = RunBuildOptionsRuleOnPj(@"
{
""buildOptions"": {
""outputName"": ""some name""
}
}");
mockProj.Properties.Count(p => p.Name == "AssemblyName").Should().Be(1);
mockProj.Properties.First(p => p.Name == "AssemblyName").Value.Should().Be("some name");
}
[Fact]
public void MigratingOutputNamePopulatesPackageIdWithTheProjectContainingFolderName()
{
var testDirectoryPath = Temp.CreateDirectory().Path;
var testDirectoryName = new DirectoryInfo(testDirectoryPath).Name;
var mockProj = RunBuildOptionsRuleOnPj(@"
{
""buildOptions"": {
""outputName"": ""some name""
}
}",
testDirectoryPath);
mockProj.Properties.Count(p => p.Name == "PackageId").Should().Be(1);
mockProj.Properties.First(p => p.Name == "PackageId").Value.Should().Be(testDirectoryName);
}
[Fact]
public void MigratingEmitEntryPointTruePopulatesOutputTypeField()
{