dotnet build raises errors MVC apps target net46.

The issue is when the ProjectContextBuilder sees a CompileTimePlaceholder "_._" file on a full framework, it assumes that dependency has to come from the "Reference Assemblies" directory.  If it can't be found there, an error is raised.  However, there are other reasons "_._" placeholders are created (when a NuGet package doesn't want its dependencies to be exposed in the Compile dependencies of its consumers). And these placeholders can exist for assemblies that aren't in the full framework - in this case System.Diagnostics.FileVersionInfo and others.

To fix this, if the reference can't be resolved from the "Reference Assemblies" folder, it is just skipped. If the compiler really needs that assembly, it will raise an error to the user.  Dotnet build shouldn't raise the error.

Fix #2906
This commit is contained in:
Eric Erhardt 2016-05-06 14:32:50 -05:00
parent 3b2ea9d14b
commit d98c1f8724
5 changed files with 49 additions and 6 deletions

View file

@ -100,5 +100,20 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
"TestLibraryWithXmlDoc.xml"
});
}
[WindowsOnlyFact]
public void It_builds_projects_targeting_net46_and_Roslyn()
{
var testInstance = TestAssetsManager
.CreateTestInstance("AppWithNet46AndRoslyn")
.WithLockFiles();
var testProject = Path.Combine(testInstance.TestRoot, "project.json");
new BuildCommand(testProject)
.Execute()
.Should()
.Pass();
}
}
}