Fix wrapped project paht resolution
This commit is contained in:
parent
7407a898e0
commit
1bfd7725b0
11 changed files with 125 additions and 3 deletions
|
@ -0,0 +1,17 @@
|
|||
// 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 System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace TestApp
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static int Main(string[] args)
|
||||
{
|
||||
Console.WriteLine(TestLibrary.Helper.GetMessage());
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>58808bbc-371e-47d6-a3d0-4902145eda4e</ProjectGuid>
|
||||
<RootNamespace>TestApp</RootNamespace>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
</Project>
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"compilationOptions": {
|
||||
"emitEntryPoint": true,
|
||||
"preserveCompilationContext": true
|
||||
},
|
||||
|
||||
"dependencies": {
|
||||
"TestLibrary": { "target":"project", "version":"1.0.0-*" },
|
||||
|
||||
"NETStandard.Library": "1.0.0-rc2-23811"
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
"dnxcore50": { }
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
noautobuild
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>TestLibraryWithConfiguration</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="M:TestLibrary.Helper.GetMessage">
|
||||
<summary>
|
||||
Gets the message from the helper. This comment is here to help test XML documentation file generation, please do not remove it.
|
||||
</summary>
|
||||
<returns>A message</returns>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"frameworks": {
|
||||
"dnxcore50": {
|
||||
"bin": {
|
||||
"assembly": "bin\\{configuration}\\dnxcore50\\TestLibrary.dll",
|
||||
"pdb": "bin\\{configuration}\\dnxcore50\\TestLibrary.pdb"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"projects": [ "."]
|
||||
}
|
|
@ -216,10 +216,14 @@ namespace Microsoft.DotNet.ProjectModel.Compilation
|
|||
var compileAsset = new LibraryAsset(
|
||||
project.Project.Name,
|
||||
null,
|
||||
Path.GetFullPath(Path.Combine(project.Project.ProjectDirectory, assemblyPath)));
|
||||
assemblyPath);
|
||||
|
||||
builder.AddCompilationAssembly(compileAsset);
|
||||
builder.AddRuntimeAsset(new LibraryAsset(Path.GetFileName(pdbPath), Path.GetFileName(pdbPath), pdbPath));
|
||||
builder.AddRuntimeAssembly(compileAsset);
|
||||
if (File.Exists(pdbPath))
|
||||
{
|
||||
builder.AddRuntimeAsset(new LibraryAsset(Path.GetFileName(pdbPath), Path.GetFileName(pdbPath), pdbPath));
|
||||
}
|
||||
}
|
||||
else if (project.Project.Files.SourceFiles.Any())
|
||||
{
|
||||
|
@ -286,7 +290,7 @@ namespace Microsoft.DotNet.ProjectModel.Compilation
|
|||
|
||||
path = path.Replace("{configuration}", configuration);
|
||||
|
||||
return path;
|
||||
return Path.Combine(project.ProjectDirectory, path);
|
||||
}
|
||||
|
||||
private LibraryExport ExportFrameworkLibrary(LibraryDescription library)
|
||||
|
|
36
test/dotnet-build.Tests/WrappedProjectTests.cs
Normal file
36
test/dotnet-build.Tests/WrappedProjectTests.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.DotNet.Cli.Utils;
|
||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||
using FluentAssertions;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.DotNet.Tools.Builder.Tests
|
||||
{
|
||||
public class WrappedProjectTests: TestBase
|
||||
{
|
||||
[Fact]
|
||||
public void WrappedProjectFilesResolvedCorrectly()
|
||||
{
|
||||
var testInstance = TestAssetsManager.CreateTestInstance("TestAppWithWrapperProjectDependency")
|
||||
.WithBuildArtifacts()
|
||||
.WithLockFiles();
|
||||
|
||||
var root = testInstance.TestRoot;
|
||||
|
||||
// run compile
|
||||
var outputDir = Path.Combine(root, "bin");
|
||||
var testProject = ProjectUtils.GetProjectJson(root, "TestApp");
|
||||
var buildCommand = new BuildCommand(testProject, output: outputDir, framework: DefaultFramework);
|
||||
var result = buildCommand.ExecuteWithCapturedOutput();
|
||||
result.Should().Pass();
|
||||
|
||||
new DirectoryInfo(outputDir).Should()
|
||||
.HaveFiles(new [] { "TestLibrary.dll", "TestLibrary.pdb" });
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue