Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Copyright (c) .NET Foundation. All rights reserved.
<Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.DefaultAssemblyInfo.targets" Condition="'$(UsingNETSdkDefaults)' == 'true'"/>

<!--
Apply the same default output paths as Microsoft.Common.targets now since we're running before them,
Apply these defaults from Microsoft.Common.CurrentVersion.targets now since we're running before them,
but need to adjust them and/or make decisions in terms of them.
-->
<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ Copyright (c) .NET Foundation. All rights reserved.
-->
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<!--
Apply these defaults from Microsoft.Common.CurrentVersion.targets now since we're running before them,
but need to adjust them and/or make decisions in terms of them.
-->
<PropertyGroup>
<Configuration Condition="'$(Configuration)'==''">Debug</Configuration>
<Platform Condition="'$(Platform)'==''">AnyCPU</Platform>
<PlatformName Condition="'$(PlatformName)' == ''">$(Platform)</PlatformName>
Comment on lines +19 to +21
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: ''=='' or '' == ''? Not sure what the standard is.

</PropertyGroup>

<Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.DefaultAssemblyInfo.targets" />
<Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.DefaultOutputPaths.targets" />
<Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.Sdk.Workloads.CrossTargeting.targets" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using System.Linq;
using FluentAssertions;
using Xunit.Abstractions;
using Microsoft.NET.TestFramework.ProjectConstruction;

namespace Microsoft.NET.Build.Tests
{
Expand Down Expand Up @@ -119,5 +120,37 @@ public void It_combines_inner_rids_for_restore(
command.ExecuteWithoutRestore().Should().Pass();
command.GetValues().Should().BeEquivalentTo(expectedCombination.Split(';'));
}

[Fact]
public void OutputPathDoesNotHaveDuplicatedBackslashesInOuterBuild()
{
var testProject = new TestProject()
{
TargetFrameworks = $"{ToolsetInfo.CurrentTargetFramework};net7.0"
};

testProject.ProjectChanges.Add(xml =>
{
var target = """
<Target Name="GetOutputPath">
<WriteLinesToFile File="$(MSBuildProjectDirectory)\OutputPathValue.txt"
Lines="$(OutputPath)"
Overwrite="true" />
</Target>
""";

xml.Root.Add(XElement.Parse(target));
});

var testAsset = _testAssetsManager.CreateTestProject(testProject);

new MSBuildCommand(testAsset, "GetOutputPath")
.Execute()
.Should()
.Pass();

string outputPathValue = File.ReadAllText(Path.Combine(testAsset.TestRoot, testProject.Name, "OutputPathValue.txt"));
outputPathValue.Trim().Should().NotContain("\\\\");
}
}
}