Skip to content

Commit

Permalink
Use Microsoft.DotNet.Cli.Utils via project reference instead of using…
Browse files Browse the repository at this point in the history
… an outdated package
  • Loading branch information
dsplaisted committed Dec 2, 2019
1 parent 0039c1d commit a964b8b
Show file tree
Hide file tree
Showing 13 changed files with 57 additions and 87 deletions.
1 change: 0 additions & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@
<PropertyGroup>
<FluentAssertionsVersion>4.19.2</FluentAssertionsVersion>
<FluentAssertionsJsonVersion>4.19.0</FluentAssertionsJsonVersion>
<MicrosoftDotNetCliUtilsVersion>2.0.0</MicrosoftDotNetCliUtilsVersion>
<MicrosoftNETTestSdkVersion>15.0.0</MicrosoftNETTestSdkVersion>
</PropertyGroup>
<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the MIT license. See License.txt in the project root for full license information. -->
<Project>

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>

<PropertyGroup>
<EnableDefaultItems>false</EnableDefaultItems>
<OutDirName>Tests\$(MSBuildProjectName)</OutDirName>
</PropertyGroup>

<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>$(SdkTargetFramework)</TargetFramework>
</PropertyGroup>

<PropertyGroup>
<!-- Strip the '-parallel none' flag here -->
<XUnitRunnerAdditionalArguments></XUnitRunnerAdditionalArguments>
Expand All @@ -22,19 +21,12 @@

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="$(FluentAssertionsVersion)" />
<PackageReference Include="Microsoft.DotNet.Cli.Utils" Version="$(MicrosoftDotNetCliUtilsVersion)" />
<PackageReference Include="NuGet.ProjectModel" Version="$(NuGetProjectModelVersion)" />
<PackageReference Include="NuGet.LibraryModel" Version="$(NuGetProjectModelVersion)" />
<PackageReference Include="NuGet.Versioning" Version="$(NuGetProjectModelVersion)" />
<PackageReference Include="NuGet.Configuration" Version="$(NuGetProjectModelVersion)" />
<PackageReference Include="NuGet.Frameworks" Version="$(NuGetProjectModelVersion)" />
<PackageReference Include="NuGet.Common" Version="$(NuGetProjectModelVersion)" />

<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="$(MicrosoftDotNetPlatformAbstractionsPackageVersion)" />

<!-- Referenced explicitly here because Microsoft.DotNet.Cli.Utils references a lower version at the moment, which causes
RAR conflicts (though ideally I would think NuGet would resolve this) -->
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="$(MicrosoftExtensionsDependencyModelVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the MIT license. See License.txt in the project root for full license information. -->
<Project>

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>

<PropertyGroup>
<EnableDefaultItems>false</EnableDefaultItems>
<OutDirName>Tests\$(MSBuildProjectName)</OutDirName>
</PropertyGroup>

<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>$(SdkTargetFramework)</TargetFramework>
</PropertyGroup>

<PropertyGroup>
<PackageId>testSdkClean</PackageId>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="$(FluentAssertionsVersion)" />
<PackageReference Include="Microsoft.DotNet.Cli.Utils" Version="$(MicrosoftDotNetCliUtilsVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,24 @@
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the MIT license. See License.txt in the project root for full license information. -->
<Project>

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>

<PropertyGroup>
<EnableDefaultItems>false</EnableDefaultItems>
<OutDirName>Tests\$(MSBuildProjectName)</OutDirName>
</PropertyGroup>

<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>$(SdkTargetFramework)</TargetFramework>
</PropertyGroup>

<PropertyGroup>
<PackageId>testSdkPack</PackageId>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="$(FluentAssertionsVersion)" />
<PackageReference Include="Microsoft.DotNet.Cli.Utils" Version="$(MicrosoftDotNetCliUtilsVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,25 @@
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the MIT license. See License.txt in the project root for full license information. -->
<Project>

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<NoWarn>$(NoWarn);xUnit1004</NoWarn>
</PropertyGroup>

<PropertyGroup>
<EnableDefaultItems>false</EnableDefaultItems>
<OutDirName>Tests\$(MSBuildProjectName)</OutDirName>
</PropertyGroup>

<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>$(SdkTargetFramework)</TargetFramework>
<NoWarn>$(NoWarn);xUnit1004</NoWarn>
</PropertyGroup>

<PropertyGroup>
<PackageId>testSdkPerf</PackageId>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Diagnostics.Tracing.TraceEvent" Version="1.0.3-alpha-experimental" />
<PackageReference Include="Microsoft.DotNet.Cli.Utils" Version="$(MicrosoftDotNetCliUtilsVersion)" />
<PackageReference Include="FluentAssertions" Version="$(FluentAssertionsVersion)" />
<PackageReference Include="xunit.performance.api" Version="1.0.0-beta-build0015" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,28 @@
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the MIT license. See License.txt in the project root for full license information. -->
<Project>

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>

<PropertyGroup>
<EnableDefaultItems>false</EnableDefaultItems>
<OutDirName>Tests\$(MSBuildProjectName)</OutDirName>
</PropertyGroup>

<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>$(SdkTargetFramework)</TargetFramework>
</PropertyGroup>

<PropertyGroup>
<PackageId>testSdkPublish</PackageId>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions.Json" Version="$(FluentAssertionsJsonVersion)" />
<PackageReference Include="Microsoft.DotNet.Cli.Utils" Version="$(MicrosoftDotNetCliUtilsVersion)" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Microsoft.NET.TestFramework\Microsoft.NET.TestFramework.csproj" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="$(MicrosoftExtensionsDependencyModelVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,24 @@
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the MIT license. See License.txt in the project root for full license information. -->
<Project>

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>

<PropertyGroup>
<EnableDefaultItems>false</EnableDefaultItems>
<OutDirName>Tests\$(MSBuildProjectName)</OutDirName>
</PropertyGroup>

<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>$(SdkTargetFramework)</TargetFramework>
</PropertyGroup>

<PropertyGroup>
<PackageId>testSdkRebuild</PackageId>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="$(FluentAssertionsVersion)" />
<PackageReference Include="Microsoft.DotNet.Cli.Utils" Version="$(MicrosoftDotNetCliUtilsVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the MIT license. See License.txt in the project root for full license information. -->
<Project>

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>

<PropertyGroup>
<EnableDefaultItems>false</EnableDefaultItems>
<OutDirName>Tests\$(MSBuildProjectName)</OutDirName>
</PropertyGroup>

<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>$(SdkTargetFramework)</TargetFramework>
</PropertyGroup>

<PropertyGroup>
<PackageId>testSdkRestore</PackageId>
</PropertyGroup>
Expand Down
19 changes: 5 additions & 14 deletions src/Tests/Microsoft.NET.TestFramework/Commands/SdkCommandSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,11 @@ private string EscapeArgs()

public ICommand ToCommand()
{
var commandSpec = new CommandSpec(FileName, EscapeArgs(), CommandResolutionStrategy.Path);
ICommand ret = Command.Create(commandSpec);
if (WorkingDirectory != null)
var process = new Process()
{
ret = ret.WorkingDirectory(WorkingDirectory);
}

// It's necessary to set the environment variables here instead of passing them to the CommandSpec constructor,
// because if they are passed to the CommandSpec constructor, they won't override existing environment variables,
// which can cause the wrong MSBuildSDKsPath to be used
foreach (var kvp in Environment)
{
ret.EnvironmentVariable(kvp.Key, kvp.Value);
}

StartInfo = ToProcessStartInfo()
};
var ret = new Command(process);
return ret;
}

Expand All @@ -49,6 +39,7 @@ public ProcessStartInfo ToProcessStartInfo()
var ret = new ProcessStartInfo();
ret.FileName = FileName;
ret.Arguments = EscapeArgs();
ret.UseShellExecute = false;
foreach (var kvp in Environment)
{
ret.Environment[kvp.Key] = kvp.Value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the MIT license. See License.txt in the project root for full license information. -->
<Project>

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>

<PropertyGroup>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<EnableDefaultItems>false</EnableDefaultItems>
Expand All @@ -14,13 +10,20 @@

<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />

<PropertyGroup>
<TargetFramework>$(SdkTargetFramework)</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="$(FluentAssertionsVersion)" />
<PackageReference Include="Microsoft.DotNet.Cli.Utils" Version="$(MicrosoftDotNetCliUtilsVersion)" />
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonVersion)" />
<PackageReference Include="xunit" Version="$(XUnitVersion)" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\Cli\Microsoft.DotNet.Cli.Utils\Microsoft.DotNet.Cli.Utils.csproj" />
</ItemGroup>

<ItemGroup>
<Compile Include="**\*.cs" Exclude="$(GlobalExclude)" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,27 @@
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the MIT license. See License.txt in the project root for full license information. -->
<Project>

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>

<PropertyGroup>
<EnableDefaultItems>false</EnableDefaultItems>
<OutDirName>Tests\$(MSBuildProjectName)</OutDirName>
</PropertyGroup>

<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>$(SdkTargetFramework)</TargetFramework>
</PropertyGroup>

<PropertyGroup>
<PackageId>testSdkToolPack</PackageId>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="$(FluentAssertionsVersion)" />
<PackageReference Include="Microsoft.DotNet.Cli.Utils" Version="$(MicrosoftDotNetCliUtilsVersion)" />
<PackageReference Include="NuGet.Packaging" Version="$(NuGetPackagingVersion)" />
<PackageReference Include="NuGet.ProjectModel" Version="$(NuGetPackagingVersion)" />
<PackageReference Include="Microsoft.NET.HostModel" Version="$(MicrosoftNETHostModelVersion)" />

<!-- Referenced explicitly here because Microsoft.DotNet.Cli.Utils references a lower version at the moment, which causes
RAR conflicts (though ideally I would think NuGet would resolve this) -->
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="$(MicrosoftExtensionsDependencyModelVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<TargetFramework>$(SdkTargetFramework)</TargetFramework>
<!--Do not use apphost since only dotnet execute has execute permission on Helix machine-->
<UseAppHost>false</UseAppHost>
</PropertyGroup>
Expand Down
7 changes: 2 additions & 5 deletions src/Tests/TelemetryStdOutLogger/TelemetryStdOutLogger.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,12 @@
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFrameworks>$(SdkTargetFramework);net472</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonVersion)" />

<!-- Reference CLI Utils in order to get references to MSBuild libraries that won't cause
conflicts when Microsoft.NET.Build.Tests references this project -->
<PackageReference Include="Microsoft.DotNet.Cli.Utils" Version="$(MicrosoftDotNetCliUtilsVersion)" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="$(MicrosoftBuildUtilitiesCorePackageVersion)" />
</ItemGroup>

<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
Expand Down

0 comments on commit a964b8b

Please sign in to comment.