Merge pull request #6356 from dsplaisted/generate-tools-deps
Use .NET SDK to generate deps.json for tools
This commit is contained in:
commit
6cb2eb0479
67 changed files with 674 additions and 659 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -115,6 +115,7 @@ artifacts/
|
|||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.binlog
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
<OutputType>Exe</OutputType>
|
||||
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">$(PackageTargetFallback);portable-net45+win8;dnxcore50</PackageTargetFallback>
|
||||
<RuntimeIdentifiers>win7-x64;win7-x86;osx.10.10-x64;osx.10.11-x64;ubuntu.14.04-x64;ubuntu.16.04-x64;ubuntu.16.10-x64;centos.7-x64;rhel.7.2-x64;debian.8-x64;fedora.24-x64;opensuse.42.1-x64</RuntimeIdentifiers>
|
||||
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
|
||||
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
<AssemblyName>AppWithRedirectsAndConfig</AssemblyName>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RuntimeIdentifiers>win7-x64;win7-x86</RuntimeIdentifiers>
|
||||
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
<AssemblyName>AppWithRedirectsNoConfig</AssemblyName>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RuntimeIdentifiers>win7-x64;win7-x86</RuntimeIdentifiers>
|
||||
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
<TargetFrameworks>netstandard1.6;net451</TargetFrameworks>
|
||||
<OutputType>Library</OutputType>
|
||||
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);portable-net45+win8;dnxcore50;netcoreapp2.0</PackageTargetFallback>
|
||||
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -3,10 +3,9 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp1.0</TargetFramework>
|
||||
<TargetFramework>netcoreapp1.1</TargetFramework>
|
||||
<AssemblyName>dotnet-throwingtool</AssemblyName>
|
||||
<PackageId>$(AssemblyName)</PackageId>
|
||||
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
|
||||
<DotnetCliToolTargetFramework>netcoreapp2.0</DotnetCliToolTargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<GeneratedPackageId>random-name</GeneratedPackageId>
|
||||
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
|
||||
<DotnetCliToolTargetFramework>netcoreapp2.0</DotnetCliToolTargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
<GeneratedPackageId>random-name</GeneratedPackageId>
|
||||
<PackageId>$(GeneratedPackageId)</PackageId>
|
||||
<AssemblyName>dotnet-randompackage</AssemblyName>
|
||||
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -6,13 +6,6 @@
|
|||
<AssemblyName>dotnet-tool-with-output-name</AssemblyName>
|
||||
<PackageId>ToolWithOutputName</PackageId>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<BuiltProjectOutputGroupOutput Include="$(ProjectRuntimeConfigFilePath)">
|
||||
<FinalOutputPath>$(ProjectRuntimeConfigFilePath)</FinalOutputPath>
|
||||
</BuiltProjectOutputGroupOutput>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -1,22 +1,12 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), testAsset.props))\testAsset.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>1.0.0-rc</VersionPrefix>
|
||||
<TargetFramework>netcoreapp1.1</TargetFramework>
|
||||
<AssemblyName>dotnet-dependency-context-test</AssemblyName>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
<PackageTargetFallback>$(PackageTargetFallback);dnxcore50;portable-net45+win8</PackageTargetFallback>
|
||||
<RuntimeFrameworkVersion>1.1.1</RuntimeFrameworkVersion>
|
||||
<DisableImplicitFrameworkReferences>false</DisableImplicitFrameworkReferences>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<BuiltProjectOutputGroupOutput Include="$(ProjectRuntimeConfigFilePath)">
|
||||
<FinalOutputPath>$(ProjectRuntimeConfigFilePath)</FinalOutputPath>
|
||||
</BuiltProjectOutputGroupOutput>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="$(DependencyModelVersion)" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
|
||||
<!-- This test asset needs to import the general dir.props in order to get the SdkNugetVersion property.
|
||||
This is why it also needs to explicitly set DisableImplicitFrameworkReferences to false. -->
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>1.0.0-rc</VersionPrefix>
|
||||
<TargetFramework>netcoreapp1.1</TargetFramework>
|
||||
<AssemblyName>dotnet-dependency-tool-invoker</AssemblyName>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8;dnxcore50</PackageTargetFallback>
|
||||
<VersionSuffix></VersionSuffix>
|
||||
<RuntimeFrameworkVersion>1.1.1</RuntimeFrameworkVersion>
|
||||
<DisableImplicitFrameworkReferences>false</DisableImplicitFrameworkReferences>
|
||||
</PropertyGroup>
|
||||
|
||||
|
@ -20,12 +20,6 @@
|
|||
<Compile Include="..\..\..\src\dotnet\CommandLine\*.cs;..\..\..\src\dotnet\CommonLocalizableStrings.cs;" Exclude="bin\**;obj\**;**\*.xproj;packages\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<BuiltProjectOutputGroupOutput Include="$(ProjectRuntimeConfigFilePath)">
|
||||
<FinalOutputPath>$(ProjectRuntimeConfigFilePath)</FinalOutputPath>
|
||||
</BuiltProjectOutputGroupOutput>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NuGet.Frameworks" Version="$(CLI_NuGet_Version)" />
|
||||
<PackageReference Include="Microsoft.DotNet.Cli.Utils" Version="$(SdkNugetVersion)" />
|
||||
|
|
|
@ -9,12 +9,6 @@
|
|||
<RuntimeIdentifiers>win7-x64;win7-x86</RuntimeIdentifiers>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.1' ">
|
||||
<BuiltProjectOutputGroupOutput Include="$(ProjectRuntimeConfigFilePath)">
|
||||
<FinalOutputPath>$(ProjectRuntimeConfigFilePath)</FinalOutputPath>
|
||||
</BuiltProjectOutputGroupOutput>
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.1' ">
|
||||
<RuntimeFrameworkVersion>1.1.1</RuntimeFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -6,12 +6,6 @@
|
|||
<AssemblyName>dotnet-fallbackfoldertool</AssemblyName>
|
||||
<OutputType>Exe</OutputType>
|
||||
<VersionSuffix></VersionSuffix>
|
||||
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<BuiltProjectOutputGroupOutput Include="$(ProjectRuntimeConfigFilePath)">
|
||||
<FinalOutputPath>$(ProjectRuntimeConfigFilePath)</FinalOutputPath>
|
||||
</BuiltProjectOutputGroupOutput>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
<!--Workaround for https://github.com/NuGet/Home/issues/4583-->
|
||||
<VersionSuffix></VersionSuffix>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
|
||||
<AssemblyName>dotnet-hello</AssemblyName>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RuntimeIdentifiers>win7-x64;win7-x86;osx.10.10-x64;osx.10.11-x64;ubuntu.14.04-x64;ubuntu.16.04-x64;ubuntu.16.10-x64;centos.7-x64;rhel.7.2-x64;debian.8-x64;fedora.24-x64;opensuse.42.1-x64</RuntimeIdentifiers>
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
<!--Workaround for https://github.com/NuGet/Home/issues/4583-->
|
||||
<VersionSuffix></VersionSuffix>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
|
||||
<AssemblyName>dotnet-hello</AssemblyName>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RuntimeIdentifiers>win7-x64;win7-x86;osx.10.10-x64;osx.10.11-x64;ubuntu.14.04-x64;ubuntu.16.04-x64;ubuntu.16.10-x64;centos.7-x64;rhel.7.2-x64;debian.8-x64;fedora.24-x64;opensuse.42.1-x64</RuntimeIdentifiers>
|
||||
|
|
|
@ -7,9 +7,4 @@
|
|||
<OutputType>Exe</OutputType>
|
||||
<RuntimeFrameworkVersion>1.1.1</RuntimeFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<BuiltProjectOutputGroupOutput Include="$(ProjectRuntimeConfigFilePath)">
|
||||
<FinalOutputPath>$(ProjectRuntimeConfigFilePath)</FinalOutputPath>
|
||||
</BuiltProjectOutputGroupOutput>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), testAsset.props))\testAsset.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp1.1</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<BuiltProjectOutputGroupOutput Include="$(ProjectRuntimeConfigFilePath)">
|
||||
<FinalOutputPath>$(ProjectRuntimeConfigFilePath)</FinalOutputPath>
|
||||
</BuiltProjectOutputGroupOutput>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\dotnet-portable\Program.cs" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,12 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), testAsset.props))\testAsset.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp1.1</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\dotnet-portable\Program.cs" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -2,6 +2,8 @@
|
|||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
namespace ConsoleApplication
|
||||
{
|
||||
|
@ -10,6 +12,20 @@ namespace ConsoleApplication
|
|||
public static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Hello Portable World!");
|
||||
|
||||
var depsFile = new FileInfo(GetDataFromAppDomain("FX_DEPS_FILE"));
|
||||
string frameworkVersion = depsFile.Directory.Name;
|
||||
|
||||
Console.WriteLine($"I'm running on shared framework version {frameworkVersion}!");
|
||||
}
|
||||
|
||||
public static string GetDataFromAppDomain(string propertyName)
|
||||
{
|
||||
var appDomainType = typeof(object).GetTypeInfo().Assembly?.GetType("System.AppDomain");
|
||||
var currentDomain = appDomainType?.GetProperty("CurrentDomain")?.GetValue(null);
|
||||
var deps = appDomainType?.GetMethod("GetData")?.Invoke(currentDomain, new[] { propertyName });
|
||||
|
||||
return deps as string;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,15 +3,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<AssemblyName>dotnet-portable</AssemblyName>
|
||||
<OutputType>Exe</OutputType>
|
||||
<VersionSuffix></VersionSuffix>
|
||||
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<BuiltProjectOutputGroupOutput Include="$(ProjectRuntimeConfigFilePath)">
|
||||
<FinalOutputPath>$(ProjectRuntimeConfigFilePath)</FinalOutputPath>
|
||||
</BuiltProjectOutputGroupOutput>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
@ -5,14 +5,9 @@
|
|||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
<VersionSuffix></VersionSuffix>
|
||||
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<BuiltProjectOutputGroupOutput Include="$(ProjectRuntimeConfigFilePath)">
|
||||
<FinalOutputPath>$(ProjectRuntimeConfigFilePath)</FinalOutputPath>
|
||||
</BuiltProjectOutputGroupOutput>
|
||||
|
||||
<Content Include="prefercliruntime">
|
||||
<Pack>true</Pack>
|
||||
<PackagePath>\prefercliruntime</PackagePath>
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
|
||||
<DotnetCliToolTargetFramework>netcoreapp2.0</DotnetCliToolTargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
|
||||
<DotnetCliToolTargetFramework>netcoreapp2.0</DotnetCliToolTargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
<AssemblyName>AppWithDirectDep</AssemblyName>
|
||||
<OutputType>Exe</OutputType>
|
||||
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
|
||||
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
|
||||
<DotnetCliToolTargetFramework>netcoreapp2.0</DotnetCliToolTargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
|
||||
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
|
||||
<DotnetCliToolTargetFramework>netcoreapp2.0</DotnetCliToolTargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFrameworks>net451;netcoreapp2.0</TargetFrameworks>
|
||||
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
|
||||
<DotnetCliToolTargetFramework>netcoreapp2.0</DotnetCliToolTargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
<OutputType>Exe</OutputType>
|
||||
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
|
||||
<PackageTargetFallback>$(PackageTargetFallback);dnxcore50;portable-net45+win8</PackageTargetFallback>
|
||||
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
|
||||
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFrameworks>net451;netcoreapp2.0</TargetFrameworks>
|
||||
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
|
@ -4,7 +4,6 @@
|
|||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFrameworks>net451;netcoreapp2.0</TargetFrameworks>
|
||||
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<RuntimeIdentifiers>win7-x64;win7-x86;osx.10.12-x64;ubuntu.14.04-x64;ubuntu.16.04-x64;ubuntu.16.10-x64;centos.7-x64;rhel.7-x64;debian.8-x64;fedora.24-x64;opensuse.42.1-x64</RuntimeIdentifiers>
|
||||
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
|
||||
<DotnetCliToolTargetFramework>netcoreapp2.0</DotnetCliToolTargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
|
||||
<!-- Issue: https://github.com/dotnet/sdk/issues/1150 -->
|
||||
<DisableImplicitPackageTargetFallback>true</DisableImplicitPackageTargetFallback>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
|
||||
<DotnetCliToolTargetFramework>netcoreapp1.1</DotnetCliToolTargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -10,10 +10,6 @@
|
|||
<DefineConstants>DESKTOP;$(DefineConstants)</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp2.0'">
|
||||
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MSTest.TestFramework" Version="1.0.6-preview" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="1.1.5-preview" />
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<CLI_SharedFrameworkVersion>2.0.0-preview1-002091-00</CLI_SharedFrameworkVersion>
|
||||
<CLI_MSBuild_Version>15.2.0-preview-000093-02</CLI_MSBuild_Version>
|
||||
<CLI_Roslyn_Version>2.0.0-rc4-61325-08</CLI_Roslyn_Version>
|
||||
<CLI_NETSDK_Version>2.0.0-alpha-20170425-6</CLI_NETSDK_Version>
|
||||
<CLI_NETSDK_Version>2.0.0-alpha-20170427-1</CLI_NETSDK_Version>
|
||||
<CLI_NuGet_Version>4.3.0-beta1-2418</CLI_NuGet_Version>
|
||||
<CLI_WEBSDK_Version>1.0.0-rel-20170413-451</CLI_WEBSDK_Version>
|
||||
<CLI_TestPlatform_Version>15.1.0-preview-20170414-04</CLI_TestPlatform_Version>
|
||||
|
|
|
@ -136,6 +136,24 @@
|
|||
<VersionSuffix></VersionSuffix>
|
||||
<Clean>True</Clean>
|
||||
</BaseTestPackageProject>
|
||||
<BaseTestPackageProject Include="TestAssets/TestPackages/dotnet-portable-v1">
|
||||
<Name>dotnet-portable</Name>
|
||||
<ProjectName>dotnet-portable-v1.csproj</ProjectName>
|
||||
<IsTool>True</IsTool>
|
||||
<IsApplicable>True</IsApplicable>
|
||||
<VersionPrefix>1.0.0</VersionPrefix>
|
||||
<VersionSuffix></VersionSuffix>
|
||||
<Clean>True</Clean>
|
||||
</BaseTestPackageProject>
|
||||
<BaseTestPackageProject Include="TestAssets/TestPackages/dotnet-portable-v1-prefercli">
|
||||
<Name>dotnet-portable</Name>
|
||||
<ProjectName>dotnet-portable-v1-prefercli.csproj</ProjectName>
|
||||
<IsTool>True</IsTool>
|
||||
<IsApplicable>True</IsApplicable>
|
||||
<VersionPrefix>1.0.0</VersionPrefix>
|
||||
<VersionSuffix></VersionSuffix>
|
||||
<Clean>True</Clean>
|
||||
</BaseTestPackageProject>
|
||||
<BaseTestPackageProject Include="TestAssets/TestPackages/dotnet-fallbackfoldertool">
|
||||
<Name>dotnet-fallbackfoldertool</Name>
|
||||
<ProjectName>dotnet-fallbackfoldertool.csproj</ProjectName>
|
||||
|
|
|
@ -67,6 +67,9 @@ if (!(Test-Path $env:DOTNET_INSTALL_DIR))
|
|||
# Disable first run since we want to control all package sources
|
||||
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
||||
|
||||
# Don't resolve shared frameworks from user or global locations
|
||||
$env:DOTNET_MULTILEVEL_LOOKUP=0
|
||||
|
||||
# Enable vs test console logging
|
||||
$env:VSTEST_BUILD_TRACE=1
|
||||
$env:VSTEST_TRACE_BUILD=1
|
||||
|
|
|
@ -151,6 +151,10 @@ export VSTEST_BUILD_TRACE=1
|
|||
export VSTEST_TRACE_BUILD=1
|
||||
|
||||
DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
||||
|
||||
# Don't resolve shared frameworks from user or global locations
|
||||
DOTNET_MULTILEVEL_LOOKUP=0
|
||||
|
||||
toolsLocalPath="$REPOROOT/build_tools"
|
||||
if [ ! -z $BOOTSTRAP_INSTALL_DIR]; then
|
||||
toolsLocalPath = $BOOTSTRAP_INSTALL_DIR
|
||||
|
|
|
@ -1,315 +0,0 @@
|
|||
// 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.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using Microsoft.Extensions.DependencyModel;
|
||||
using NuGet.Frameworks;
|
||||
using NuGet.Packaging;
|
||||
using NuGet.Packaging.Core;
|
||||
using NuGet.ProjectModel;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Utils
|
||||
{
|
||||
internal class DepsJsonBuilder
|
||||
{
|
||||
private readonly VersionFolderPathResolver _versionFolderPathResolver;
|
||||
|
||||
public DepsJsonBuilder()
|
||||
{
|
||||
// This resolver is only used for building file names, so that base path is not required.
|
||||
_versionFolderPathResolver = new VersionFolderPathResolver(rootPath: null);
|
||||
}
|
||||
|
||||
public DependencyContext Build(
|
||||
SingleProjectInfo mainProjectInfo,
|
||||
CompilationOptions compilationOptions,
|
||||
LockFile lockFile,
|
||||
NuGetFramework framework,
|
||||
string runtime)
|
||||
{
|
||||
bool includeCompilationLibraries = compilationOptions != null;
|
||||
|
||||
LockFileTarget lockFileTarget = lockFile.GetTarget(framework, runtime);
|
||||
|
||||
IEnumerable<LockFileTargetLibrary> runtimeExports = lockFileTarget.GetRuntimeLibraries();
|
||||
IEnumerable<LockFileTargetLibrary> compilationExports =
|
||||
includeCompilationLibraries ?
|
||||
lockFileTarget.GetCompileLibraries() :
|
||||
Enumerable.Empty<LockFileTargetLibrary>();
|
||||
|
||||
var dependencyLookup = compilationExports
|
||||
.Concat(runtimeExports)
|
||||
.Distinct()
|
||||
.Select(library => new Dependency(library.Name, library.Version.ToString()))
|
||||
.ToDictionary(dependency => dependency.Name, StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
var libraryLookup = lockFile.Libraries.ToDictionary(l => l.Name, StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
var runtimeSignature = GenerateRuntimeSignature(runtimeExports);
|
||||
|
||||
IEnumerable<RuntimeLibrary> runtimeLibraries =
|
||||
GetLibraries(runtimeExports, libraryLookup, dependencyLookup, runtime: true).Cast<RuntimeLibrary>();
|
||||
|
||||
IEnumerable<CompilationLibrary> compilationLibraries;
|
||||
if (includeCompilationLibraries)
|
||||
{
|
||||
CompilationLibrary projectCompilationLibrary = GetProjectCompilationLibrary(
|
||||
mainProjectInfo,
|
||||
lockFile,
|
||||
lockFileTarget,
|
||||
dependencyLookup);
|
||||
compilationLibraries = new[] { projectCompilationLibrary }
|
||||
.Concat(
|
||||
GetLibraries(compilationExports, libraryLookup, dependencyLookup, runtime: false)
|
||||
.Cast<CompilationLibrary>());
|
||||
}
|
||||
else
|
||||
{
|
||||
compilationLibraries = Enumerable.Empty<CompilationLibrary>();
|
||||
}
|
||||
|
||||
return new DependencyContext(
|
||||
new TargetInfo(framework.DotNetFrameworkName, runtime, runtimeSignature, lockFileTarget.IsPortable()),
|
||||
compilationOptions ?? CompilationOptions.Default,
|
||||
compilationLibraries,
|
||||
runtimeLibraries,
|
||||
new RuntimeFallbacks[] { });
|
||||
}
|
||||
|
||||
private static string GenerateRuntimeSignature(IEnumerable<LockFileTargetLibrary> runtimeExports)
|
||||
{
|
||||
var sha1 = SHA1.Create();
|
||||
var builder = new StringBuilder();
|
||||
var packages = runtimeExports
|
||||
.Where(libraryExport => libraryExport.Type == "package");
|
||||
var separator = "|";
|
||||
foreach (var libraryExport in packages)
|
||||
{
|
||||
builder.Append(libraryExport.Name);
|
||||
builder.Append(separator);
|
||||
builder.Append(libraryExport.Version.ToString());
|
||||
builder.Append(separator);
|
||||
}
|
||||
var hash = sha1.ComputeHash(Encoding.UTF8.GetBytes(builder.ToString()));
|
||||
|
||||
builder.Clear();
|
||||
foreach (var hashByte in hash)
|
||||
{
|
||||
builder.AppendFormat("{0:x2}", hashByte);
|
||||
}
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
private List<Dependency> GetProjectDependencies(
|
||||
LockFile lockFile,
|
||||
LockFileTarget lockFileTarget,
|
||||
Dictionary<string, Dependency> dependencyLookup)
|
||||
{
|
||||
|
||||
List<Dependency> dependencies = new List<Dependency>();
|
||||
|
||||
IEnumerable<ProjectFileDependencyGroup> projectFileDependencies = lockFile
|
||||
.ProjectFileDependencyGroups
|
||||
.Where(dg => dg.FrameworkName == string.Empty ||
|
||||
dg.FrameworkName == lockFileTarget.TargetFramework.DotNetFrameworkName);
|
||||
|
||||
foreach (string projectFileDependency in projectFileDependencies.SelectMany(dg => dg.Dependencies))
|
||||
{
|
||||
int separatorIndex = projectFileDependency.IndexOf(' ');
|
||||
string dependencyName = separatorIndex > 0 ?
|
||||
projectFileDependency.Substring(0, separatorIndex) :
|
||||
projectFileDependency;
|
||||
|
||||
Dependency dependency;
|
||||
if (dependencyLookup.TryGetValue(dependencyName, out dependency))
|
||||
{
|
||||
dependencies.Add(dependency);
|
||||
}
|
||||
}
|
||||
|
||||
return dependencies;
|
||||
}
|
||||
|
||||
private RuntimeLibrary GetProjectRuntimeLibrary(
|
||||
SingleProjectInfo projectInfo,
|
||||
LockFile lockFile,
|
||||
LockFileTarget lockFileTarget,
|
||||
Dictionary<string, Dependency> dependencyLookup)
|
||||
{
|
||||
|
||||
RuntimeAssetGroup[] runtimeAssemblyGroups = new[] { new RuntimeAssetGroup(string.Empty, projectInfo.GetOutputName()) };
|
||||
|
||||
List<Dependency> dependencies = GetProjectDependencies(lockFile, lockFileTarget, dependencyLookup);
|
||||
|
||||
ResourceAssembly[] resourceAssemblies = projectInfo
|
||||
.ResourceAssemblies
|
||||
.Select(r => new ResourceAssembly(r.RelativePath, r.Culture))
|
||||
.ToArray();
|
||||
|
||||
return new RuntimeLibrary(
|
||||
type: "project",
|
||||
name: projectInfo.Name,
|
||||
version: projectInfo.Version,
|
||||
hash: string.Empty,
|
||||
runtimeAssemblyGroups: runtimeAssemblyGroups,
|
||||
nativeLibraryGroups: new RuntimeAssetGroup[] { },
|
||||
resourceAssemblies: resourceAssemblies,
|
||||
dependencies: dependencies.ToArray(),
|
||||
serviceable: false);
|
||||
}
|
||||
|
||||
private CompilationLibrary GetProjectCompilationLibrary(
|
||||
SingleProjectInfo projectInfo,
|
||||
LockFile lockFile,
|
||||
LockFileTarget lockFileTarget,
|
||||
Dictionary<string, Dependency> dependencyLookup)
|
||||
{
|
||||
List<Dependency> dependencies = GetProjectDependencies(lockFile, lockFileTarget, dependencyLookup);
|
||||
|
||||
return new CompilationLibrary(
|
||||
type: "project",
|
||||
name: projectInfo.Name,
|
||||
version: projectInfo.Version,
|
||||
hash: string.Empty,
|
||||
assemblies: new[] { projectInfo.GetOutputName() },
|
||||
dependencies: dependencies.ToArray(),
|
||||
serviceable: false);
|
||||
}
|
||||
|
||||
private IEnumerable<Library> GetLibraries(
|
||||
IEnumerable<LockFileTargetLibrary> exports,
|
||||
IDictionary<string, LockFileLibrary> libraryLookup,
|
||||
IDictionary<string, Dependency> dependencyLookup,
|
||||
bool runtime)
|
||||
{
|
||||
return exports.Select(export => GetLibrary(export, libraryLookup, dependencyLookup, runtime));
|
||||
}
|
||||
|
||||
private Library GetLibrary(
|
||||
LockFileTargetLibrary export,
|
||||
IDictionary<string, LockFileLibrary> libraryLookup,
|
||||
IDictionary<string, Dependency> dependencyLookup,
|
||||
bool runtime)
|
||||
{
|
||||
var type = export.Type;
|
||||
|
||||
// TEMPORARY: All packages are serviceable in RC2
|
||||
// See https://github.com/dotnet/cli/issues/2569
|
||||
var serviceable = export.Type == "package";
|
||||
var libraryDependencies = new HashSet<Dependency>();
|
||||
|
||||
foreach (PackageDependency libraryDependency in export.Dependencies)
|
||||
{
|
||||
Dependency dependency;
|
||||
if (dependencyLookup.TryGetValue(libraryDependency.Id, out dependency))
|
||||
{
|
||||
libraryDependencies.Add(dependency);
|
||||
}
|
||||
}
|
||||
|
||||
string hash = string.Empty;
|
||||
string path = null;
|
||||
string hashPath = null;
|
||||
LockFileLibrary library;
|
||||
if (libraryLookup.TryGetValue(export.Name, out library))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(library.Sha512))
|
||||
{
|
||||
hash = "sha512-" + library.Sha512;
|
||||
hashPath = _versionFolderPathResolver.GetHashFileName(export.Name, export.Version);
|
||||
}
|
||||
|
||||
path = library.Path;
|
||||
}
|
||||
|
||||
if (runtime)
|
||||
{
|
||||
return new RuntimeLibrary(
|
||||
type.ToLowerInvariant(),
|
||||
export.Name,
|
||||
export.Version.ToString(),
|
||||
hash,
|
||||
CreateRuntimeAssemblyGroups(export),
|
||||
CreateNativeLibraryGroups(export),
|
||||
export.ResourceAssemblies.FilterPlaceHolderFiles().Select(CreateResourceAssembly),
|
||||
libraryDependencies,
|
||||
serviceable,
|
||||
path,
|
||||
hashPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
IEnumerable<string> assemblies = export
|
||||
.CompileTimeAssemblies
|
||||
.FilterPlaceHolderFiles()
|
||||
.Select(libraryAsset => libraryAsset.Path);
|
||||
|
||||
return new CompilationLibrary(
|
||||
type.ToString().ToLowerInvariant(),
|
||||
export.Name,
|
||||
export.Version.ToString(),
|
||||
hash,
|
||||
assemblies,
|
||||
libraryDependencies,
|
||||
serviceable,
|
||||
path,
|
||||
hashPath);
|
||||
}
|
||||
}
|
||||
|
||||
private IReadOnlyList<RuntimeAssetGroup> CreateRuntimeAssemblyGroups(LockFileTargetLibrary export)
|
||||
{
|
||||
List<RuntimeAssetGroup> assemblyGroups = new List<RuntimeAssetGroup>();
|
||||
|
||||
assemblyGroups.Add(
|
||||
new RuntimeAssetGroup(
|
||||
string.Empty,
|
||||
export.RuntimeAssemblies.FilterPlaceHolderFiles().Select(a => a.Path)));
|
||||
|
||||
foreach (var runtimeTargetsGroup in export.GetRuntimeTargetsGroups("runtime"))
|
||||
{
|
||||
assemblyGroups.Add(
|
||||
new RuntimeAssetGroup(
|
||||
runtimeTargetsGroup.Key,
|
||||
runtimeTargetsGroup.Select(t => t.Path)));
|
||||
}
|
||||
|
||||
return assemblyGroups;
|
||||
}
|
||||
|
||||
private IReadOnlyList<RuntimeAssetGroup> CreateNativeLibraryGroups(LockFileTargetLibrary export)
|
||||
{
|
||||
List<RuntimeAssetGroup> nativeGroups = new List<RuntimeAssetGroup>();
|
||||
|
||||
nativeGroups.Add(
|
||||
new RuntimeAssetGroup(
|
||||
string.Empty,
|
||||
export.NativeLibraries.FilterPlaceHolderFiles().Select(a => a.Path)));
|
||||
|
||||
foreach (var runtimeTargetsGroup in export.GetRuntimeTargetsGroups("native"))
|
||||
{
|
||||
nativeGroups.Add(
|
||||
new RuntimeAssetGroup(
|
||||
runtimeTargetsGroup.Key,
|
||||
runtimeTargetsGroup.Select(t => t.Path)));
|
||||
}
|
||||
|
||||
return nativeGroups;
|
||||
}
|
||||
|
||||
private ResourceAssembly CreateResourceAssembly(LockFileItem resourceAssembly)
|
||||
{
|
||||
string locale;
|
||||
if (!resourceAssembly.Properties.TryGetValue("locale", out locale))
|
||||
{
|
||||
locale = null;
|
||||
}
|
||||
|
||||
return new ResourceAssembly(resourceAssembly.Path, locale);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -13,17 +13,7 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
string commandName,
|
||||
IEnumerable<string> commandArguments,
|
||||
IEnumerable<string> allowedExtensions,
|
||||
string nugetPackagesRoot,
|
||||
CommandResolutionStrategy commandResolutionStrategy,
|
||||
string depsFilePath,
|
||||
string runtimeConfigPath);
|
||||
|
||||
CommandSpec CreateCommandSpecFromLibrary(
|
||||
LockFileTargetLibrary toolLibrary,
|
||||
string commandName,
|
||||
IEnumerable<string> commandArguments,
|
||||
IEnumerable<string> allowedExtensions,
|
||||
IEnumerable<string> packageFolders,
|
||||
LockFile lockFile,
|
||||
CommandResolutionStrategy commandResolutionStrategy,
|
||||
string depsFilePath,
|
||||
string runtimeConfigPath);
|
||||
|
|
|
@ -26,5 +26,7 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
NuGetFramework DotnetCliToolTargetFramework { get; }
|
||||
|
||||
Dictionary<string, string> EnvironmentVariables { get; }
|
||||
|
||||
string ToolDepsJsonGeneratorProject { get; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,6 +92,19 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
}
|
||||
}
|
||||
|
||||
public string ToolDepsJsonGeneratorProject
|
||||
{
|
||||
get
|
||||
{
|
||||
var generatorProject = _project
|
||||
.AllEvaluatedProperties
|
||||
.FirstOrDefault(p => p.Name.Equals("ToolDepsJsonGeneratorProject"))
|
||||
?.EvaluatedValue;
|
||||
|
||||
return generatorProject;
|
||||
}
|
||||
}
|
||||
|
||||
public MSBuildProject(
|
||||
string msBuildProjectPath,
|
||||
NuGetFramework framework,
|
||||
|
|
|
@ -27,28 +27,7 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
string commandName,
|
||||
IEnumerable<string> commandArguments,
|
||||
IEnumerable<string> allowedExtensions,
|
||||
string nugetPackagesRoot,
|
||||
CommandResolutionStrategy commandResolutionStrategy,
|
||||
string depsFilePath,
|
||||
string runtimeConfigPath)
|
||||
{
|
||||
return CreateCommandSpecFromLibrary(
|
||||
toolLibrary,
|
||||
commandName,
|
||||
commandArguments,
|
||||
allowedExtensions,
|
||||
new List<string> { nugetPackagesRoot },
|
||||
commandResolutionStrategy,
|
||||
depsFilePath,
|
||||
runtimeConfigPath);
|
||||
}
|
||||
|
||||
public CommandSpec CreateCommandSpecFromLibrary(
|
||||
LockFileTargetLibrary toolLibrary,
|
||||
string commandName,
|
||||
IEnumerable<string> commandArguments,
|
||||
IEnumerable<string> allowedExtensions,
|
||||
IEnumerable<string> packageFolders,
|
||||
LockFile lockFile,
|
||||
CommandResolutionStrategy commandResolutionStrategy,
|
||||
string depsFilePath,
|
||||
string runtimeConfigPath)
|
||||
|
@ -72,7 +51,7 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
return null;
|
||||
}
|
||||
|
||||
var commandPath = GetCommandFilePath(packageFolders, toolLibrary, toolAssembly);
|
||||
var commandPath = GetCommandFilePath(lockFile, toolLibrary, toolAssembly);
|
||||
|
||||
if (!File.Exists(commandPath))
|
||||
{
|
||||
|
@ -89,21 +68,16 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
commandArguments,
|
||||
depsFilePath,
|
||||
commandResolutionStrategy,
|
||||
packageFolders,
|
||||
lockFile.GetNormalizedPackageFolders(),
|
||||
runtimeConfigPath);
|
||||
}
|
||||
|
||||
private string GetCommandFilePath(
|
||||
IEnumerable<string> packageFolders,
|
||||
LockFile lockFile,
|
||||
LockFileTargetLibrary toolLibrary,
|
||||
LockFileItem runtimeAssembly)
|
||||
{
|
||||
var packageFoldersCount = packageFolders.Count();
|
||||
var userPackageFolder = packageFoldersCount == 1 ? string.Empty : packageFolders.First();
|
||||
var fallbackPackageFolders = packageFoldersCount > 1 ? packageFolders.Skip(1) : packageFolders;
|
||||
|
||||
var packageDirectory = new FallbackPackagePathResolver(userPackageFolder, fallbackPackageFolders)
|
||||
.GetPackageDirectory(toolLibrary.Name, toolLibrary.Version);
|
||||
var packageDirectory = lockFile.GetPackageDirectory(toolLibrary);
|
||||
|
||||
if (packageDirectory == null)
|
||||
{
|
||||
|
|
|
@ -21,11 +21,51 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
{
|
||||
if(PrefersCliRuntime(commandPath))
|
||||
{
|
||||
arguments.Add("--fx-version");
|
||||
arguments.Add(new Muxer().SharedFxVersion);
|
||||
var runtimeConfigFile = Path.ChangeExtension(commandPath, FileNameSuffixes.RuntimeConfigJson);
|
||||
|
||||
if (!File.Exists(runtimeConfigFile))
|
||||
{
|
||||
throw new GracefulException(string.Format(LocalizableStrings.CouldNotFindToolRuntimeConfigFile,
|
||||
nameof(PackagedCommandSpecFactory),
|
||||
Path.GetFileName(commandPath)));
|
||||
}
|
||||
|
||||
var runtimeConfig = new RuntimeConfig(runtimeConfigFile);
|
||||
|
||||
var muxer = new Muxer();
|
||||
|
||||
Version currentFrameworkSimpleVersion = GetVersionWithoutPrerelease(muxer.SharedFxVersion);
|
||||
Version toolFrameworkSimpleVersion = GetVersionWithoutPrerelease(runtimeConfig.Framework.Version);
|
||||
|
||||
if (currentFrameworkSimpleVersion.Major != toolFrameworkSimpleVersion.Major)
|
||||
{
|
||||
Reporter.Verbose.WriteLine(
|
||||
string.Format(
|
||||
LocalizableStrings.IgnoringPreferCLIRuntimeFile,
|
||||
nameof(PackagedCommandSpecFactory),
|
||||
runtimeConfig.Framework.Version,
|
||||
muxer.SharedFxVersion));
|
||||
}
|
||||
else
|
||||
{
|
||||
arguments.Add("--fx-version");
|
||||
arguments.Add(muxer.SharedFxVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static Version GetVersionWithoutPrerelease(string version)
|
||||
{
|
||||
int dashOrPlusIndex = version.IndexOfAny(new char[] { '-', '+' });
|
||||
|
||||
if (dashOrPlusIndex >= 0)
|
||||
{
|
||||
version = version.Substring(0, dashOrPlusIndex);
|
||||
}
|
||||
|
||||
return new Version(version);
|
||||
}
|
||||
|
||||
private static bool PrefersCliRuntime(string commandPath)
|
||||
{
|
||||
var libTFMPackageDirectory = Path.GetDirectoryName(commandPath);
|
||||
|
@ -35,7 +75,7 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
Reporter.Verbose.WriteLine(
|
||||
string.Format(
|
||||
LocalizableStrings.LookingForPreferCliRuntimeFile,
|
||||
"packagedcommandspecfactory",
|
||||
nameof(PackagedCommandSpecFactory),
|
||||
preferCliRuntimePath));
|
||||
|
||||
return File.Exists(preferCliRuntimePath);
|
||||
|
|
|
@ -120,15 +120,13 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
|
||||
var lockFile = project.GetLockFile();
|
||||
var toolLibrary = GetToolLibraryForContext(lockFile, commandName, framework);
|
||||
var normalizedNugetPackagesRoot =
|
||||
PathUtility.EnsureNoTrailingDirectorySeparator(lockFile.PackageFolders.First().Path);
|
||||
|
||||
var commandSpec = _packagedCommandSpecFactory.CreateCommandSpecFromLibrary(
|
||||
toolLibrary,
|
||||
commandName,
|
||||
commandArguments,
|
||||
allowedExtensions,
|
||||
normalizedNugetPackagesRoot,
|
||||
lockFile,
|
||||
s_commandResolutionStrategy,
|
||||
depsFilePath,
|
||||
runtimeConfigPath);
|
||||
|
|
|
@ -170,10 +170,8 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
toolLibraryRange,
|
||||
toolPackageFramework,
|
||||
toolLockFile,
|
||||
depsFileRoot);
|
||||
|
||||
var packageFolders = toolLockFile.PackageFolders.Select(p =>
|
||||
PathUtility.EnsureNoTrailingDirectorySeparator(p.Path));
|
||||
depsFileRoot,
|
||||
project.ToolDepsJsonGeneratorProject);
|
||||
|
||||
Reporter.Verbose.WriteLine(string.Format(
|
||||
LocalizableStrings.AttemptingToCreateCommandSpec,
|
||||
|
@ -184,7 +182,7 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
commandName,
|
||||
args,
|
||||
_allowedCommandExtensions,
|
||||
packageFolders,
|
||||
toolLockFile,
|
||||
s_commandResolutionStrategy,
|
||||
depsFilePath,
|
||||
null);
|
||||
|
@ -281,7 +279,8 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
SingleProjectInfo toolLibrary,
|
||||
NuGetFramework framework,
|
||||
LockFile toolLockFile,
|
||||
string depsPathRoot)
|
||||
string depsPathRoot,
|
||||
string toolDepsJsonGeneratorProject)
|
||||
{
|
||||
var depsJsonPath = Path.Combine(
|
||||
depsPathRoot,
|
||||
|
@ -292,7 +291,7 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
ProjectToolsCommandResolverName,
|
||||
depsJsonPath));
|
||||
|
||||
EnsureToolJsonDepsFileExists(toolLockFile, framework, depsJsonPath, toolLibrary);
|
||||
EnsureToolJsonDepsFileExists(toolLockFile, framework, depsJsonPath, toolLibrary, toolDepsJsonGeneratorProject);
|
||||
|
||||
return depsJsonPath;
|
||||
}
|
||||
|
@ -301,11 +300,12 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
LockFile toolLockFile,
|
||||
NuGetFramework framework,
|
||||
string depsPath,
|
||||
SingleProjectInfo toolLibrary)
|
||||
SingleProjectInfo toolLibrary,
|
||||
string toolDepsJsonGeneratorProject)
|
||||
{
|
||||
if (!File.Exists(depsPath))
|
||||
{
|
||||
GenerateDepsJsonFile(toolLockFile, framework, depsPath, toolLibrary);
|
||||
GenerateDepsJsonFile(toolLockFile, framework, depsPath, toolLibrary, toolDepsJsonGeneratorProject);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -313,21 +313,80 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
LockFile toolLockFile,
|
||||
NuGetFramework framework,
|
||||
string depsPath,
|
||||
SingleProjectInfo toolLibrary)
|
||||
SingleProjectInfo toolLibrary,
|
||||
string toolDepsJsonGeneratorProject)
|
||||
{
|
||||
if (string.IsNullOrEmpty(toolDepsJsonGeneratorProject) ||
|
||||
!File.Exists(toolDepsJsonGeneratorProject))
|
||||
{
|
||||
throw new GracefulException(LocalizableStrings.DepsJsonGeneratorProjectNotSet);
|
||||
}
|
||||
|
||||
Reporter.Verbose.WriteLine(string.Format(
|
||||
LocalizableStrings.GeneratingDepsJson,
|
||||
depsPath));
|
||||
|
||||
var dependencyContext = new DepsJsonBuilder()
|
||||
.Build(toolLibrary, null, toolLockFile, framework, null);
|
||||
|
||||
var tempDepsFile = Path.GetTempFileName();
|
||||
using (var fileStream = File.Open(tempDepsFile, FileMode.Open, FileAccess.Write))
|
||||
{
|
||||
var dependencyContextWriter = new DependencyContextWriter();
|
||||
|
||||
dependencyContextWriter.Write(dependencyContext, fileStream);
|
||||
var args = new List<string>();
|
||||
|
||||
args.Add(toolDepsJsonGeneratorProject);
|
||||
args.Add($"/p:ProjectAssetsFile=\"{toolLockFile.Path}\"");
|
||||
args.Add($"/p:ToolName={toolLibrary.Name}");
|
||||
args.Add($"/p:ProjectDepsFilePath={tempDepsFile}");
|
||||
|
||||
var toolTargetFramework = toolLockFile.Targets.First().TargetFramework.GetShortFolderName();
|
||||
args.Add($"/p:TargetFramework={toolTargetFramework}");
|
||||
|
||||
|
||||
// Look for the .props file in the Microsoft.NETCore.App package, until NuGet
|
||||
// generates .props and .targets files for tool restores (https://github.com/NuGet/Home/issues/5037)
|
||||
var platformLibrary = toolLockFile.Targets
|
||||
.FirstOrDefault(t => framework == t.TargetFramework)
|
||||
?.GetPlatformLibrary();
|
||||
|
||||
if (platformLibrary != null)
|
||||
{
|
||||
string buildRelativePath = platformLibrary.Build.FirstOrDefault()?.Path;
|
||||
|
||||
var platformLibraryPath = toolLockFile.GetPackageDirectory(platformLibrary);
|
||||
|
||||
if (platformLibraryPath != null && buildRelativePath != null)
|
||||
{
|
||||
// Get rid of "_._" filename
|
||||
buildRelativePath = Path.GetDirectoryName(buildRelativePath);
|
||||
|
||||
string platformLibraryBuildFolderPath = Path.Combine(platformLibraryPath, buildRelativePath);
|
||||
var platformLibraryPropsFile = Directory.GetFiles(platformLibraryBuildFolderPath, "*.props").FirstOrDefault();
|
||||
|
||||
if (platformLibraryPropsFile != null)
|
||||
{
|
||||
args.Add($"/p:AdditionalImport={platformLibraryPropsFile}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Delete temporary file created by Path.GetTempFileName(), otherwise the GenerateBuildDependencyFile target
|
||||
// will think the deps file is up-to-date and skip executing
|
||||
File.Delete(tempDepsFile);
|
||||
|
||||
var msBuildExePath = _environment.GetEnvironmentVariable(Constants.MSBUILD_EXE_PATH);
|
||||
|
||||
msBuildExePath = string.IsNullOrEmpty(msBuildExePath) ?
|
||||
Path.Combine(AppContext.BaseDirectory, "MSBuild.dll") :
|
||||
msBuildExePath;
|
||||
|
||||
var result = new MSBuildForwardingAppWithoutLogging(args, msBuildExePath)
|
||||
.GetProcessStartInfo()
|
||||
.ExecuteAndCaptureOutput(out string stdOut, out string stdErr);
|
||||
|
||||
if (result != 0)
|
||||
{
|
||||
Reporter.Verbose.WriteLine(string.Format(
|
||||
LocalizableStrings.UnableToGenerateDepsJson,
|
||||
stdOut + Environment.NewLine + stdErr));
|
||||
|
||||
throw new GracefulException(string.Format(LocalizableStrings.UnableToGenerateDepsJson, toolDepsJsonGeneratorProject));
|
||||
}
|
||||
|
||||
try
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
// 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 Microsoft.DotNet.Tools.Common;
|
||||
using NuGet.Packaging;
|
||||
using NuGet.ProjectModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Utils
|
||||
{
|
||||
static class LockFileExtensions
|
||||
{
|
||||
public static string GetPackageDirectory(this LockFile lockFile, LockFileTargetLibrary library)
|
||||
{
|
||||
var packageFolders = lockFile.GetNormalizedPackageFolders();
|
||||
|
||||
var packageFoldersCount = packageFolders.Count();
|
||||
var userPackageFolder = packageFoldersCount == 1 ? string.Empty : packageFolders.First();
|
||||
var fallbackPackageFolders = packageFoldersCount > 1 ? packageFolders.Skip(1) : packageFolders;
|
||||
|
||||
var packageDirectory = new FallbackPackagePathResolver(userPackageFolder, fallbackPackageFolders)
|
||||
.GetPackageDirectory(library.Name, library.Version);
|
||||
|
||||
return packageDirectory;
|
||||
}
|
||||
|
||||
public static IEnumerable<string> GetNormalizedPackageFolders(this LockFile lockFile)
|
||||
{
|
||||
return lockFile.PackageFolders.Select(p =>
|
||||
PathUtility.EnsureNoTrailingDirectorySeparator(p.Path));
|
||||
}
|
||||
}
|
||||
}
|
108
src/Microsoft.DotNet.Cli.Utils/ForwardingAppImplementation.cs
Normal file
108
src/Microsoft.DotNet.Cli.Utils/ForwardingAppImplementation.cs
Normal file
|
@ -0,0 +1,108 @@
|
|||
// 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.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using Microsoft.DotNet.Cli.Utils;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Utils
|
||||
{
|
||||
/// <summary>
|
||||
/// A class which encapsulates logic needed to forward arguments from the current process to another process
|
||||
/// invoked with the dotnet.exe host.
|
||||
/// </summary>
|
||||
internal class ForwardingAppImplementation
|
||||
{
|
||||
private const string HostExe = "dotnet";
|
||||
|
||||
private readonly string _forwardApplicationPath;
|
||||
private readonly IEnumerable<string> _argsToForward;
|
||||
private readonly string _depsFile;
|
||||
private readonly string _runtimeConfig;
|
||||
private readonly string _additionalProbingPath;
|
||||
private Dictionary<string, string> _environmentVariables;
|
||||
|
||||
private readonly string[] _allArgs;
|
||||
|
||||
public ForwardingAppImplementation(
|
||||
string forwardApplicationPath,
|
||||
IEnumerable<string> argsToForward,
|
||||
string depsFile = null,
|
||||
string runtimeConfig = null,
|
||||
string additionalProbingPath = null,
|
||||
Dictionary<string, string> environmentVariables = null)
|
||||
{
|
||||
_forwardApplicationPath = forwardApplicationPath;
|
||||
_argsToForward = argsToForward;
|
||||
_depsFile = depsFile;
|
||||
_runtimeConfig = runtimeConfig;
|
||||
_additionalProbingPath = additionalProbingPath;
|
||||
_environmentVariables = environmentVariables;
|
||||
|
||||
var allArgs = new List<string>();
|
||||
allArgs.Add("exec");
|
||||
|
||||
if (_depsFile != null)
|
||||
{
|
||||
allArgs.Add("--depsfile");
|
||||
allArgs.Add(_depsFile);
|
||||
}
|
||||
|
||||
if (_runtimeConfig != null)
|
||||
{
|
||||
allArgs.Add("--runtimeconfig");
|
||||
allArgs.Add(_runtimeConfig);
|
||||
}
|
||||
|
||||
if (_additionalProbingPath != null)
|
||||
{
|
||||
allArgs.Add("--additionalprobingpath");
|
||||
allArgs.Add(_additionalProbingPath);
|
||||
}
|
||||
|
||||
allArgs.Add(_forwardApplicationPath);
|
||||
allArgs.AddRange(_argsToForward);
|
||||
|
||||
_allArgs = allArgs.ToArray();
|
||||
}
|
||||
|
||||
public int Execute()
|
||||
{
|
||||
return GetProcessStartInfo().Execute();
|
||||
}
|
||||
|
||||
public ProcessStartInfo GetProcessStartInfo()
|
||||
{
|
||||
var processInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = GetHostExeName(),
|
||||
Arguments = ArgumentEscaper.EscapeAndConcatenateArgArrayForProcessStart(_allArgs),
|
||||
UseShellExecute = false
|
||||
};
|
||||
|
||||
if (_environmentVariables != null)
|
||||
{
|
||||
foreach (var entry in _environmentVariables)
|
||||
{
|
||||
processInfo.Environment[entry.Key] = entry.Value;
|
||||
}
|
||||
}
|
||||
|
||||
return processInfo;
|
||||
}
|
||||
|
||||
public ForwardingAppImplementation WithEnvironmentVariable(string name, string value)
|
||||
{
|
||||
_environmentVariables = _environmentVariables ?? new Dictionary<string, string>();
|
||||
|
||||
_environmentVariables.Add(name, value);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private string GetHostExeName()
|
||||
{
|
||||
return $"{HostExe}{FileNameSuffixes.CurrentPlatform.Exe}";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,6 +19,10 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
|
||||
public const string LookingForPreferCliRuntimeFile = "{0}: Looking for prefercliruntime file at `{1}`";
|
||||
|
||||
public const string IgnoringPreferCLIRuntimeFile = "{0}: Ignoring prefercliruntime file as the tool target framework ({1}) has a different major version than the current CLI runtime ({2})";
|
||||
|
||||
public const string CouldNotFindToolRuntimeConfigFile = "{0}: Could not find runtimeconfig.json file for tool {1}";
|
||||
|
||||
public const string AttemptingToResolve = "{0}: attempting to resolve {1}";
|
||||
|
||||
public const string DidNotFindAMatchingProject = "{0}: Did not find a matching project {1}.";
|
||||
|
@ -61,6 +65,8 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
|
||||
public const string UnableToGenerateDepsJson = "unable to generate deps.json, it may have been already generated: {0}";
|
||||
|
||||
public const string DepsJsonGeneratorProjectNotSet = "Unable to find deps.json generator project.";
|
||||
|
||||
public const string UnableToDeleteTemporaryDepsJson = "unable to delete temporary deps.json file: {0}";
|
||||
|
||||
public const string VersionForPackageCouldNotBeResolved = "Version for package `{0}` could not be resolved.";
|
||||
|
|
|
@ -0,0 +1,87 @@
|
|||
// 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.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Utils
|
||||
{
|
||||
internal class MSBuildForwardingAppWithoutLogging
|
||||
{
|
||||
private const string MSBuildExeName = "MSBuild.dll";
|
||||
|
||||
private const string SdksDirectoryName = "Sdks";
|
||||
|
||||
private readonly ForwardingAppImplementation _forwardingApp;
|
||||
|
||||
private readonly Dictionary<string, string> _msbuildRequiredEnvironmentVariables =
|
||||
new Dictionary<string, string>
|
||||
{
|
||||
{ "MSBuildExtensionsPath", AppContext.BaseDirectory },
|
||||
{ "CscToolExe", GetRunCscPath() },
|
||||
{ "MSBuildSDKsPath", GetMSBuildSDKsPath() }
|
||||
};
|
||||
|
||||
private readonly IEnumerable<string> _msbuildRequiredParameters =
|
||||
new List<string> { "/m", "/v:m" };
|
||||
|
||||
public MSBuildForwardingAppWithoutLogging(IEnumerable<string> argsToForward, string msbuildPath = null)
|
||||
{
|
||||
_forwardingApp = new ForwardingAppImplementation(
|
||||
msbuildPath ?? GetMSBuildExePath(),
|
||||
_msbuildRequiredParameters.Concat(argsToForward.Select(Escape)),
|
||||
environmentVariables: _msbuildRequiredEnvironmentVariables);
|
||||
}
|
||||
|
||||
public virtual ProcessStartInfo GetProcessStartInfo()
|
||||
{
|
||||
return _forwardingApp
|
||||
.GetProcessStartInfo();
|
||||
}
|
||||
|
||||
public int Execute()
|
||||
{
|
||||
return GetProcessStartInfo().Execute();
|
||||
}
|
||||
|
||||
private static string Escape(string arg) =>
|
||||
// this is a workaround for https://github.com/Microsoft/msbuild/issues/1622
|
||||
(arg.StartsWith("/p:RestoreSources=", StringComparison.OrdinalIgnoreCase)) ?
|
||||
arg.Replace(";", "%3B")
|
||||
.Replace("://", ":%2F%2F") :
|
||||
arg;
|
||||
|
||||
private static string GetMSBuildExePath()
|
||||
{
|
||||
return Path.Combine(
|
||||
AppContext.BaseDirectory,
|
||||
MSBuildExeName);
|
||||
}
|
||||
|
||||
private static string GetMSBuildSDKsPath()
|
||||
{
|
||||
var envMSBuildSDKsPath = Environment.GetEnvironmentVariable("MSBuildSDKsPath");
|
||||
|
||||
if (envMSBuildSDKsPath != null)
|
||||
{
|
||||
return envMSBuildSDKsPath;
|
||||
}
|
||||
|
||||
return Path.Combine(
|
||||
AppContext.BaseDirectory,
|
||||
SdksDirectoryName);
|
||||
}
|
||||
|
||||
private static string GetRunCscPath()
|
||||
{
|
||||
var scriptExtension = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".cmd" : ".sh";
|
||||
return Path.Combine(AppContext.BaseDirectory, "Roslyn", $"RunCsc{scriptExtension}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
60
src/Microsoft.DotNet.Cli.Utils/ProcessStartInfoExtensions.cs
Normal file
60
src/Microsoft.DotNet.Cli.Utils/ProcessStartInfoExtensions.cs
Normal file
|
@ -0,0 +1,60 @@
|
|||
// 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 Microsoft.DotNet.Cli.Utils
|
||||
{
|
||||
internal static class ProcessStartInfoExtensions
|
||||
{
|
||||
public static int Execute(this ProcessStartInfo startInfo)
|
||||
{
|
||||
if (startInfo == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(startInfo));
|
||||
}
|
||||
|
||||
var process = new Process
|
||||
{
|
||||
StartInfo = startInfo
|
||||
};
|
||||
|
||||
process.Start();
|
||||
process.WaitForExit();
|
||||
|
||||
return process.ExitCode;
|
||||
}
|
||||
|
||||
public static int ExecuteAndCaptureOutput(this ProcessStartInfo startInfo, out string stdOut, out string stdErr)
|
||||
{
|
||||
var outStream = new StreamForwarder().Capture();
|
||||
var errStream = new StreamForwarder().Capture();
|
||||
|
||||
startInfo.RedirectStandardOutput = true;
|
||||
startInfo.RedirectStandardError = true;
|
||||
|
||||
var process = new Process
|
||||
{
|
||||
StartInfo = startInfo
|
||||
};
|
||||
|
||||
process.EnableRaisingEvents = true;
|
||||
|
||||
process.Start();
|
||||
|
||||
var taskOut = outStream.BeginRead(process.StandardOutput);
|
||||
var taskErr = errStream.BeginRead(process.StandardError);
|
||||
|
||||
process.WaitForExit();
|
||||
|
||||
taskOut.Wait();
|
||||
taskErr.Wait();
|
||||
|
||||
stdOut = outStream.CapturedOutput;
|
||||
stdErr = errStream.CapturedOutput;
|
||||
|
||||
return process.ExitCode;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,28 +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 Microsoft.DotNet.Cli.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using Microsoft.DotNet.Cli.Utils;
|
||||
using System.Text;
|
||||
|
||||
namespace Microsoft.DotNet.Cli
|
||||
{
|
||||
/// <summary>
|
||||
/// A class which encapsulates logic needed to forward arguments from the current process to another process
|
||||
/// invoked with the dotnet.exe host.
|
||||
/// </summary>
|
||||
public class ForwardingApp
|
||||
{
|
||||
private const string s_hostExe = "dotnet";
|
||||
|
||||
private readonly string _forwardApplicationPath;
|
||||
private readonly IEnumerable<string> _argsToForward;
|
||||
private readonly string _depsFile;
|
||||
private readonly string _runtimeConfig;
|
||||
private readonly string _additionalProbingPath;
|
||||
private Dictionary<string, string> _environmentVariables;
|
||||
|
||||
private readonly string[] _allArgs;
|
||||
private ForwardingAppImplementation _implementation;
|
||||
|
||||
public ForwardingApp(
|
||||
string forwardApplicationPath,
|
||||
|
@ -32,77 +21,29 @@ namespace Microsoft.DotNet.Cli
|
|||
string additionalProbingPath = null,
|
||||
Dictionary<string, string> environmentVariables = null)
|
||||
{
|
||||
_forwardApplicationPath = forwardApplicationPath;
|
||||
_argsToForward = argsToForward;
|
||||
_depsFile = depsFile;
|
||||
_runtimeConfig = runtimeConfig;
|
||||
_additionalProbingPath = additionalProbingPath;
|
||||
_environmentVariables = environmentVariables;
|
||||
|
||||
var allArgs = new List<string>();
|
||||
allArgs.Add("exec");
|
||||
|
||||
if (_depsFile != null)
|
||||
{
|
||||
allArgs.Add("--depsfile");
|
||||
allArgs.Add(_depsFile);
|
||||
}
|
||||
|
||||
if (_runtimeConfig != null)
|
||||
{
|
||||
allArgs.Add("--runtimeconfig");
|
||||
allArgs.Add(_runtimeConfig);
|
||||
}
|
||||
|
||||
if (_additionalProbingPath != null)
|
||||
{
|
||||
allArgs.Add("--additionalprobingpath");
|
||||
allArgs.Add(_additionalProbingPath);
|
||||
}
|
||||
|
||||
allArgs.Add(_forwardApplicationPath);
|
||||
allArgs.AddRange(_argsToForward);
|
||||
|
||||
_allArgs = allArgs.ToArray();
|
||||
}
|
||||
|
||||
public int Execute()
|
||||
{
|
||||
return GetProcessStartInfo().Execute();
|
||||
_implementation = new ForwardingAppImplementation(
|
||||
forwardApplicationPath,
|
||||
argsToForward,
|
||||
depsFile,
|
||||
runtimeConfig,
|
||||
additionalProbingPath,
|
||||
environmentVariables);
|
||||
}
|
||||
|
||||
public ProcessStartInfo GetProcessStartInfo()
|
||||
{
|
||||
var processInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = GetHostExeName(),
|
||||
Arguments = ArgumentEscaper.EscapeAndConcatenateArgArrayForProcessStart(_allArgs),
|
||||
UseShellExecute = false
|
||||
};
|
||||
|
||||
if (_environmentVariables != null)
|
||||
{
|
||||
foreach (var entry in _environmentVariables)
|
||||
{
|
||||
processInfo.Environment[entry.Key] = entry.Value;
|
||||
}
|
||||
}
|
||||
|
||||
return processInfo;
|
||||
return _implementation.GetProcessStartInfo();
|
||||
}
|
||||
|
||||
public ForwardingApp WithEnvironmentVariable(string name, string value)
|
||||
{
|
||||
_environmentVariables = _environmentVariables ?? new Dictionary<string, string>();
|
||||
|
||||
_environmentVariables.Add(name, value);
|
||||
|
||||
_implementation = _implementation.WithEnvironmentVariable(name, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
private string GetHostExeName()
|
||||
public int Execute()
|
||||
{
|
||||
return $"{s_hostExe}{FileNameSuffixes.CurrentPlatform.Exe}";
|
||||
return _implementation.Execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Microsoft.DotNet.Cli;
|
||||
using Microsoft.DotNet.Cli.Utils;
|
||||
|
||||
namespace Microsoft.DotNet.Tools
|
||||
{
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
// 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 Microsoft.DotNet.Cli
|
||||
{
|
||||
internal static class ProcessStartInfoExtensions
|
||||
{
|
||||
public static int Execute(this ProcessStartInfo startInfo)
|
||||
{
|
||||
if (startInfo == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(startInfo));
|
||||
}
|
||||
|
||||
var process = new Process
|
||||
{
|
||||
StartInfo = startInfo
|
||||
};
|
||||
|
||||
process.Start();
|
||||
process.WaitForExit();
|
||||
|
||||
return process.ExitCode;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,6 +10,7 @@ using System.Runtime.InteropServices;
|
|||
using Microsoft.DotNet.Cli;
|
||||
using Microsoft.DotNet.Cli.CommandLine;
|
||||
using System.Diagnostics;
|
||||
using Microsoft.DotNet.Cli.Utils;
|
||||
|
||||
namespace Microsoft.DotNet.Tools.MSBuild
|
||||
{
|
||||
|
@ -17,24 +18,9 @@ namespace Microsoft.DotNet.Tools.MSBuild
|
|||
{
|
||||
internal const string TelemetrySessionIdEnvironmentVariableName = "DOTNET_CLI_TELEMETRY_SESSIONID";
|
||||
|
||||
private const string MSBuildExeName = "MSBuild.dll";
|
||||
private MSBuildForwardingAppWithoutLogging _forwardingAppWithoutLogging;
|
||||
|
||||
private const string SdksDirectoryName = "Sdks";
|
||||
|
||||
private readonly ForwardingApp _forwardingApp;
|
||||
|
||||
private readonly Dictionary<string, string> _msbuildRequiredEnvironmentVariables =
|
||||
new Dictionary<string, string>
|
||||
{
|
||||
{ "MSBuildExtensionsPath", AppContext.BaseDirectory },
|
||||
{ "CscToolExe", GetRunCscPath() },
|
||||
{ "MSBuildSDKsPath", GetMSBuildSDKsPath() }
|
||||
};
|
||||
|
||||
private readonly IEnumerable<string> _msbuildRequiredParameters =
|
||||
new List<string> { "/m", "/v:m" };
|
||||
|
||||
public MSBuildForwardingApp(IEnumerable<string> argsToForward, string msbuildPath = null)
|
||||
private static IEnumerable<string> ConcatTelemetryLogger(IEnumerable<string> argsToForward)
|
||||
{
|
||||
if (Telemetry.CurrentSessionId != null)
|
||||
{
|
||||
|
@ -42,7 +28,7 @@ namespace Microsoft.DotNet.Tools.MSBuild
|
|||
{
|
||||
Type loggerType = typeof(MSBuildLogger);
|
||||
|
||||
argsToForward = argsToForward
|
||||
return argsToForward
|
||||
.Concat(new[]
|
||||
{
|
||||
$"/Logger:{loggerType.FullName},{loggerType.GetTypeInfo().Assembly.Location}"
|
||||
|
@ -53,57 +39,28 @@ namespace Microsoft.DotNet.Tools.MSBuild
|
|||
// Exceptions during telemetry shouldn't cause anything else to fail
|
||||
}
|
||||
}
|
||||
return argsToForward;
|
||||
}
|
||||
|
||||
_forwardingApp = new ForwardingApp(
|
||||
msbuildPath ?? GetMSBuildExePath(),
|
||||
_msbuildRequiredParameters.Concat(argsToForward.Select(Escape)),
|
||||
environmentVariables: _msbuildRequiredEnvironmentVariables);
|
||||
public MSBuildForwardingApp(IEnumerable<string> argsToForward, string msbuildPath = null)
|
||||
{
|
||||
_forwardingAppWithoutLogging = new MSBuildForwardingAppWithoutLogging(
|
||||
ConcatTelemetryLogger(argsToForward),
|
||||
msbuildPath);
|
||||
}
|
||||
|
||||
public ProcessStartInfo GetProcessStartInfo()
|
||||
{
|
||||
return _forwardingApp
|
||||
.WithEnvironmentVariable(TelemetrySessionIdEnvironmentVariableName, Telemetry.CurrentSessionId)
|
||||
.GetProcessStartInfo();
|
||||
var ret = _forwardingAppWithoutLogging.GetProcessStartInfo();
|
||||
|
||||
ret.Environment[TelemetrySessionIdEnvironmentVariableName] = Telemetry.CurrentSessionId;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public int Execute()
|
||||
{
|
||||
return GetProcessStartInfo().Execute();
|
||||
}
|
||||
|
||||
private static string Escape(string arg) =>
|
||||
// this is a workaround for https://github.com/Microsoft/msbuild/issues/1622
|
||||
(arg.StartsWith("/p:RestoreSources=", StringComparison.OrdinalIgnoreCase)) ?
|
||||
arg.Replace(";", "%3B")
|
||||
.Replace("://", ":%2F%2F") :
|
||||
arg;
|
||||
|
||||
private static string GetMSBuildExePath()
|
||||
{
|
||||
return Path.Combine(
|
||||
AppContext.BaseDirectory,
|
||||
MSBuildExeName);
|
||||
}
|
||||
|
||||
private static string GetMSBuildSDKsPath()
|
||||
{
|
||||
var envMSBuildSDKsPath = Environment.GetEnvironmentVariable("MSBuildSDKsPath");
|
||||
|
||||
if (envMSBuildSDKsPath != null)
|
||||
{
|
||||
return envMSBuildSDKsPath;
|
||||
}
|
||||
|
||||
return Path.Combine(
|
||||
AppContext.BaseDirectory,
|
||||
SdksDirectoryName);
|
||||
}
|
||||
|
||||
private static string GetRunCscPath()
|
||||
{
|
||||
var scriptExtension = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".cmd" : ".sh";
|
||||
return Path.Combine(AppContext.BaseDirectory, "Roslyn", $"RunCsc{scriptExtension}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ namespace Microsoft.DotNet.Tests.EndToEnd
|
|||
.And.HaveStdOutContaining("Hello I prefer the cli runtime World!");;
|
||||
}
|
||||
|
||||
[RequiresSpecificFrameworkFact("netcoreapp1.1")] // https://github.com/dotnet/cli/issues/6087
|
||||
[Fact]
|
||||
public void ItCanRunAToolThatInvokesADependencyToolInACSProj()
|
||||
{
|
||||
var repoDirectoriesProvider = new RepoDirectoriesProvider();
|
||||
|
|
|
@ -281,7 +281,8 @@ namespace Microsoft.DotNet.Tests
|
|||
lockFile,
|
||||
s_toolPackageFramework,
|
||||
depsJsonFile,
|
||||
new SingleProjectInfo("dotnet-portable", "1.0.0", Enumerable.Empty<ResourceAssemblyInfo>()));
|
||||
new SingleProjectInfo("dotnet-portable", "1.0.0", Enumerable.Empty<ResourceAssemblyInfo>()),
|
||||
GetToolDepsJsonGeneratorProject());
|
||||
|
||||
File.ReadAllText(depsJsonFile).Should().Be("temp");
|
||||
File.Delete(depsJsonFile);
|
||||
|
@ -456,5 +457,12 @@ namespace Microsoft.DotNet.Tests
|
|||
|
||||
return projectToolsCommandResolver;
|
||||
}
|
||||
|
||||
private string GetToolDepsJsonGeneratorProject()
|
||||
{
|
||||
// When using the product, the ToolDepsJsonGeneratorProject property is used to get this path, but for testing
|
||||
// we'll hard code the path inside the SDK since we don't have a project to evaluate here
|
||||
return Path.Combine(new RepoDirectoriesProvider().Stage2Sdk, "Sdks", "Microsoft.NET.Sdk", "build", "GenerateDeps", "GenerateDeps.proj");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
{
|
||||
public class GivenAppThrowingException : TestBase
|
||||
{
|
||||
[Fact]
|
||||
[RequiresSpecificFrameworkFact("netcoreapp1.1")]
|
||||
public void ItShowsStackTraceWhenRun()
|
||||
{
|
||||
var root = TestAssets.Get("NonRestoredTestProjects", "AppThrowingException")
|
||||
|
@ -28,15 +28,15 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
string msg1 = "Unhandled Exception: AppThrowing.MyException: "
|
||||
+ "Exception of type 'AppThrowing.MyException' was thrown.";
|
||||
string msg2 = "at AppThrowing.MyException.Main(String[] args)";
|
||||
new RunCommand()
|
||||
new DotnetCommand(DotnetUnderTest.WithBackwardsCompatibleRuntimes)
|
||||
.WithWorkingDirectory(appRoot)
|
||||
.ExecuteWithCapturedOutput()
|
||||
.ExecuteWithCapturedOutput("run")
|
||||
.Should().Fail()
|
||||
.And.HaveStdErrContaining(msg1)
|
||||
.And.HaveStdErrContaining(msg2);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[RequiresSpecificFrameworkFact("netcoreapp1.1")]
|
||||
public void ItShowsStackTraceWhenRunAsTool()
|
||||
{
|
||||
var root = TestAssets.Get("NonRestoredTestProjects", "AppThrowingException")
|
||||
|
@ -67,7 +67,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
string msg1 = "Unhandled Exception: AppThrowing.MyException: "
|
||||
+ "Exception of type 'AppThrowing.MyException' was thrown.";
|
||||
string msg2 = "at AppThrowing.MyException.Main(String[] args)";
|
||||
new DotnetCommand()
|
||||
new DotnetCommand(DotnetUnderTest.WithBackwardsCompatibleRuntimes)
|
||||
.WithWorkingDirectory(appWithToolDepRoot)
|
||||
.ExecuteWithCapturedOutput("throwingtool")
|
||||
.Should().Fail()
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
// 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 Microsoft.DotNet.Tools.Test.Utilities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||
{
|
||||
public class RequiresSpecificFrameworkTheoryAttribute : TheoryAttribute
|
||||
{
|
||||
public RequiresSpecificFrameworkTheoryAttribute(string framework)
|
||||
{
|
||||
if (!EnvironmentInfo.HasSharedFramework(framework))
|
||||
{
|
||||
this.Skip = $"This test requires a shared framework that isn't present: {framework}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -13,8 +13,7 @@ namespace Microsoft.DotNet.Cli.Build.Tests
|
|||
{
|
||||
public class GivenThatWeWantToBeBackwardsCompatibleWith1xProjects : TestBase
|
||||
{
|
||||
[Theory]
|
||||
[InlineData("netcoreapp1.0")]
|
||||
[RequiresSpecificFrameworkTheory("netcoreapp1.1")]
|
||||
[InlineData("netcoreapp1.1")]
|
||||
public void ItRestoresBuildsAndRuns(string target)
|
||||
{
|
||||
|
|
|
@ -14,6 +14,8 @@ using NuGet.Protocol;
|
|||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
using MSBuildCommand = Microsoft.DotNet.Tools.Test.Utilities.MSBuildCommand;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.MSBuild.Tests
|
||||
{
|
||||
|
@ -164,11 +166,16 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
|
|||
|
||||
MSBuildForwardingApp msBuildForwardingApp = new MSBuildForwardingApp(Enumerable.Empty<string>());
|
||||
|
||||
FieldInfo forwardingAppFieldInfo = msBuildForwardingApp
|
||||
object forwardingAppWithoutLogging = msBuildForwardingApp
|
||||
.GetType()
|
||||
.GetField("_forwardingAppWithoutLogging", BindingFlags.Instance | BindingFlags.NonPublic)
|
||||
?.GetValue(msBuildForwardingApp);
|
||||
|
||||
FieldInfo forwardingAppFieldInfo = forwardingAppWithoutLogging
|
||||
.GetType()
|
||||
.GetField("_forwardingApp", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
|
||||
ForwardingApp forwardingApp = forwardingAppFieldInfo?.GetValue(msBuildForwardingApp) as ForwardingApp;
|
||||
object forwardingApp = forwardingAppFieldInfo?.GetValue(forwardingAppWithoutLogging);
|
||||
|
||||
FieldInfo allArgsFieldinfo = forwardingApp?
|
||||
.GetType()
|
||||
|
|
|
@ -91,6 +91,80 @@ namespace Microsoft.DotNet.Tests
|
|||
.And.Pass();
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(true)]
|
||||
[InlineData(false)]
|
||||
public void IfPreviousVersionOfSharedFrameworkIsNotInstalled_ToolsTargetingItFail(bool toolPrefersCLIRuntime)
|
||||
{
|
||||
var testInstance = TestAssets.Get("AppWithToolDependency")
|
||||
.CreateInstance(identifier: toolPrefersCLIRuntime ? "preferCLIRuntime" : "")
|
||||
.WithSourceFiles()
|
||||
.WithNuGetConfig(new RepoDirectoriesProvider().TestPackages);
|
||||
|
||||
testInstance = testInstance.WithProjectChanges(project =>
|
||||
{
|
||||
var ns = project.Root.Name.Namespace;
|
||||
|
||||
var toolReference = project.Descendants(ns + "DotNetCliToolReference")
|
||||
.Where(tr => tr.Attribute("Include").Value == "dotnet-portable")
|
||||
.Single();
|
||||
|
||||
toolReference.Attribute("Include").Value =
|
||||
toolPrefersCLIRuntime ? "dotnet-portable-v1-prefercli" : "dotnet-portable-v1";
|
||||
});
|
||||
|
||||
testInstance = testInstance.WithRestoreFiles();
|
||||
|
||||
new BuildCommand()
|
||||
.WithProjectDirectory(testInstance.Root)
|
||||
.Execute()
|
||||
.Should().Pass();
|
||||
|
||||
new GenericCommand(toolPrefersCLIRuntime ? "portable-v1-prefercli" : "portable-v1")
|
||||
.WithWorkingDirectory(testInstance.Root)
|
||||
.Execute()
|
||||
.Should().Fail();
|
||||
}
|
||||
|
||||
[RequiresSpecificFrameworkTheory("netcoreapp1.1")]
|
||||
[InlineData(true)]
|
||||
[InlineData(false)]
|
||||
public void IfPreviousVersionOfSharedFrameworkIsInstalled_ToolsTargetingItRun(bool toolPrefersCLIRuntime)
|
||||
{
|
||||
var testInstance = TestAssets.Get("AppWithToolDependency")
|
||||
.CreateInstance(identifier: toolPrefersCLIRuntime ? "preferCLIRuntime" : "")
|
||||
.WithSourceFiles()
|
||||
.WithNuGetConfig(new RepoDirectoriesProvider().TestPackages);
|
||||
|
||||
testInstance = testInstance.WithProjectChanges(project =>
|
||||
{
|
||||
var ns = project.Root.Name.Namespace;
|
||||
|
||||
var toolReference = project.Descendants(ns + "DotNetCliToolReference")
|
||||
.Where(tr => tr.Attribute("Include").Value == "dotnet-portable")
|
||||
.Single();
|
||||
|
||||
toolReference.Attribute("Include").Value =
|
||||
toolPrefersCLIRuntime ? "dotnet-portable-v1-prefercli" : "dotnet-portable-v1";
|
||||
});
|
||||
|
||||
testInstance = testInstance.WithRestoreFiles();
|
||||
|
||||
new BuildCommand()
|
||||
.WithProjectDirectory(testInstance.Root)
|
||||
.Execute()
|
||||
.Should().Pass();
|
||||
|
||||
var result =
|
||||
new DotnetCommand(DotnetUnderTest.WithBackwardsCompatibleRuntimes)
|
||||
.WithWorkingDirectory(testInstance.Root)
|
||||
.Execute(toolPrefersCLIRuntime ? "portable-v1-prefercli" : "portable-v1");
|
||||
|
||||
result.Should().Pass()
|
||||
.And.HaveStdOutContaining("I'm running on shared framework version 1.1.1!");
|
||||
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CanInvokeToolWhosePackageNameIsDifferentFromDllName()
|
||||
{
|
||||
|
@ -112,7 +186,7 @@ namespace Microsoft.DotNet.Tests
|
|||
.And.Pass();
|
||||
}
|
||||
|
||||
[RequiresSpecificFrameworkFact("netcoreapp1.1")] // https://github.com/dotnet/cli/issues/6087
|
||||
[Fact]
|
||||
public void CanInvokeToolFromDirectDependenciesIfPackageNameDifferentFromToolName()
|
||||
{
|
||||
var testInstance = TestAssets.Get("AppWithDirectDepWithOutputName")
|
||||
|
@ -242,7 +316,7 @@ namespace Microsoft.DotNet.Tests
|
|||
.Should().Fail();
|
||||
}
|
||||
|
||||
[RequiresSpecificFrameworkFact("netcoreapp1.1")] // https://github.com/dotnet/cli/issues/6087
|
||||
[Fact]
|
||||
public void ToolsCanAccessDependencyContextProperly()
|
||||
{
|
||||
var testInstance = TestAssets.Get("DependencyContextFromTool")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue