Skip to content
Closed
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
2 changes: 1 addition & 1 deletion src/Tasks.UnitTests/OutputPathTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void BothBaseOutputPathAndOutputPathWereNotSpecified()
project.Build(new MockLogger(_output)).ShouldBeFalse();

// Assert
project.GetPropertyValue("BaseOutputPath").ShouldBe(baseOutputPath + '\\');
project.GetPropertyValue("BaseOutputPath").ShouldBe(baseOutputPath.WithTrailingSlash());
project.GetPropertyValue("BaseOutputPathWasSpecified").ShouldBe(string.Empty);
project.GetPropertyValue("_OutputPathWasMissing").ShouldBe("true");
}
Expand Down
14 changes: 7 additions & 7 deletions src/Tasks.UnitTests/ProjectExtensionsImportTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,25 +171,25 @@ public void ErrorIfChangedInBodyOfProject()

MockLogger logger = new MockLogger();

project.Build("_CheckForInvalidConfigurationAndPlatform", new[] {logger}).ShouldBeFalse();
project.Build("_CheckForInvalidOutputPaths", new[] {logger}).ShouldBeFalse();

logger.Errors.Select(i => i.Code).FirstOrDefault().ShouldBe("MSB3540");
}

/// <summary>
/// Ensures that an error is logged if BaseIntermediateOutputPath is modified after it was set by Microsoft.Common.props and
/// EnableBaseIntermediateOutputPathMismatchWarning is 'true'.
/// Ensures that an error is logged if BuildDir is modified after it was set by Microsoft.Common.props and
/// EnableBuildDirMismatchWarning is 'true'.
/// </summary>
[Fact]
public void WarningIfBaseIntermediateOutputPathIsChangedInBodyOfProject()
public void WarningIfBuildDirIsChangedInBodyOfProject()
{
Project project = ObjectModelHelpers.LoadProjectFileInTempProjectDirectory(ObjectModelHelpers.CreateFileInTempProjectDirectory(_projectRelativePath, @"
<Project DefaultTargets=`Build` ToolsVersion=`msbuilddefaulttoolsversion` xmlns=`http://schemas.microsoft.com/developer/msbuild/2003`>
<Import Project=`$(MSBuildBinPath)\Microsoft.Common.props` />

<PropertyGroup>
<EnableBaseIntermediateOutputPathMismatchWarning>true</EnableBaseIntermediateOutputPathMismatchWarning>
<BaseIntermediateOutputPath>foo</BaseIntermediateOutputPath>
<EnableBuildDirMismatchWarning>true</EnableBuildDirMismatchWarning>
<BuildDir>foo</BuildDir>
</PropertyGroup>

<Import Project=`$(MSBuildBinPath)\Microsoft.CSharp.targets` />
Expand All @@ -198,7 +198,7 @@ public void WarningIfBaseIntermediateOutputPathIsChangedInBodyOfProject()

MockLogger logger = new MockLogger();

project.Build("_CheckForInvalidConfigurationAndPlatform", new[] { logger }).ShouldBeTrue();
project.Build("_CheckForInvalidOutputPaths", new[] { logger }).ShouldBeTrue();

logger.Warnings.Select(i => i.Code).FirstOrDefault().ShouldBe("MSB3539");
}
Expand Down
6 changes: 3 additions & 3 deletions src/Tasks.UnitTests/ProjectExtensionsPropsImportTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ namespace Microsoft.Build.UnitTests
/// </summary>
sealed public class ProjectExtensionsPropsImportTest : ProjectExtensionsImportTestBase
{
protected override string CustomImportProjectPath => Path.Combine(ObjectModelHelpers.TempProjectDir, "obj", $"{Path.GetFileName(_projectRelativePath)}.custom.props");
protected override string CustomImportProjectPath => Path.Combine(ObjectModelHelpers.TempProjectDir, "ext", $"{Path.GetFileName(_projectRelativePath)}.custom.props");

protected override string ImportProjectPath => Path.Combine(Path.GetDirectoryName(_projectRelativePath), "obj", $"{Path.GetFileName(_projectRelativePath)}.custom.props");
protected override string ImportProjectPath => Path.Combine(Path.GetDirectoryName(_projectRelativePath), "ext", $"{Path.GetFileName(_projectRelativePath)}.custom.props");

protected override string PropertyNameToEnableImport => "ImportProjectExtensionProps";

protected override string PropertyNameToSignalImportSucceeded => "WasProjectExtensionPropsImported";
}
}
}
6 changes: 3 additions & 3 deletions src/Tasks.UnitTests/ProjectExtensionsTargetsImportTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ namespace Microsoft.Build.UnitTests
/// </summary>
sealed public class ProjectExtensionsTargetsImportTest : ProjectExtensionsImportTestBase
{
protected override string CustomImportProjectPath => Path.Combine(ObjectModelHelpers.TempProjectDir, "obj", $"{Path.GetFileName(_projectRelativePath)}.custom.targets");
protected override string CustomImportProjectPath => Path.Combine(ObjectModelHelpers.TempProjectDir, "ext", $"{Path.GetFileName(_projectRelativePath)}.custom.targets");

protected override string ImportProjectPath => Path.Combine(Path.GetDirectoryName(_projectRelativePath), "obj", $"{Path.GetFileName(_projectRelativePath)}.custom.targets");
protected override string ImportProjectPath => Path.Combine(Path.GetDirectoryName(_projectRelativePath), "ext", $"{Path.GetFileName(_projectRelativePath)}.custom.targets");

protected override string PropertyNameToEnableImport => "ImportProjectExtensionTargets";

protected override string PropertyNameToSignalImportSucceeded => "WasProjectExtensionTargetsImported";
}
}
}
2 changes: 1 addition & 1 deletion src/Tasks/Microsoft.Common.CrossTargeting.targets
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ Copyright (C) Microsoft Corporation. All rights reserved.
<PropertyGroup Condition="'$(ImportDirectoryBuildTargets)' == 'true' and '$(DirectoryBuildTargetsPath)' == ''">
<_DirectoryBuildTargetsFile Condition="'$(_DirectoryBuildTargetsFile)' == ''">Directory.Build.targets</_DirectoryBuildTargetsFile>
<_DirectoryBuildTargetsBasePath Condition="'$(_DirectoryBuildTargetsBasePath)' == ''">$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), '$(_DirectoryBuildTargetsFile)'))</_DirectoryBuildTargetsBasePath>
<DirectoryBuildTargetsPath Condition="'$(_DirectoryBuildTargetsBasePath)' != '' and '$(_DirectoryBuildTargetsFile)' != ''">$([System.IO.Path]::Combine('$(_DirectoryBuildTargetsBasePath)', '$(_DirectoryBuildTargetsFile)'))</DirectoryBuildTargetsPath>
<DirectoryBuildTargetsPath Condition="'$(_DirectoryBuildTargetsBasePath)' != '' and '$(_DirectoryBuildTargetsFile)' != ''">$([MSBuild]::NormalizePath('$(_DirectoryBuildTargetsBasePath)', '$(_DirectoryBuildTargetsFile)'))</DirectoryBuildTargetsPath>
</PropertyGroup>

<Import Project="$(DirectoryBuildTargetsPath)" Condition="'$(ImportDirectoryBuildTargets)' == 'true' and exists('$(DirectoryBuildTargetsPath)')"/>
Expand Down
Loading