Show error if tools package doesn't include runtimeconfig file

For test assets, don't explicitly include the runtimeconfig file, as the pack command does it automatically
This commit is contained in:
Daniel Plaisted 2017-04-26 17:59:08 -07:00
parent 0afd0b9975
commit d471037ce3
12 changed files with 11 additions and 55 deletions

View file

@ -8,10 +8,4 @@
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>
<BuiltProjectOutputGroupOutput Include="$(ProjectRuntimeConfigFilePath)">
<FinalOutputPath>$(ProjectRuntimeConfigFilePath)</FinalOutputPath>
</BuiltProjectOutputGroupOutput>
</ItemGroup>
</Project>

View file

@ -7,12 +7,6 @@
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>
<BuiltProjectOutputGroupOutput Include="$(ProjectRuntimeConfigFilePath)">
<FinalOutputPath>$(ProjectRuntimeConfigFilePath)</FinalOutputPath>
</BuiltProjectOutputGroupOutput>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="$(DependencyModelVersion)" />
</ItemGroup>

View file

@ -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)" />

View file

@ -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>

View file

@ -8,9 +8,4 @@
<VersionSuffix></VersionSuffix>
</PropertyGroup>
<ItemGroup>
<BuiltProjectOutputGroupOutput Include="$(ProjectRuntimeConfigFilePath)">
<FinalOutputPath>$(ProjectRuntimeConfigFilePath)</FinalOutputPath>
</BuiltProjectOutputGroupOutput>
</ItemGroup>
</Project>

View file

@ -7,9 +7,4 @@
<OutputType>Exe</OutputType>
<RuntimeFrameworkVersion>1.1.1</RuntimeFrameworkVersion>
</PropertyGroup>
<ItemGroup>
<BuiltProjectOutputGroupOutput Include="$(ProjectRuntimeConfigFilePath)">
<FinalOutputPath>$(ProjectRuntimeConfigFilePath)</FinalOutputPath>
</BuiltProjectOutputGroupOutput>
</ItemGroup>
</Project>

View file

@ -14,10 +14,5 @@
<ItemGroup>
<Compile Include="..\dotnet-portable\Program.cs" />
<Content Include="..\dotnet-prefercliruntime\prefercliruntime">
<Pack>true</Pack>
<PackagePath>\prefercliruntime</PackagePath>
</Content>
</ItemGroup>
</Project>

View file

@ -6,12 +6,6 @@
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>
<BuiltProjectOutputGroupOutput Include="$(ProjectRuntimeConfigFilePath)">
<FinalOutputPath>$(ProjectRuntimeConfigFilePath)</FinalOutputPath>
</BuiltProjectOutputGroupOutput>
</ItemGroup>
<ItemGroup>
<Compile Include="..\dotnet-portable\Program.cs" />
</ItemGroup>

View file

@ -6,9 +6,4 @@
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>
<BuiltProjectOutputGroupOutput Include="$(ProjectRuntimeConfigFilePath)">
<FinalOutputPath>$(ProjectRuntimeConfigFilePath)</FinalOutputPath>
</BuiltProjectOutputGroupOutput>
</ItemGroup>
</Project>

View file

@ -8,10 +8,6 @@
</PropertyGroup>
<ItemGroup>
<BuiltProjectOutputGroupOutput Include="$(ProjectRuntimeConfigFilePath)">
<FinalOutputPath>$(ProjectRuntimeConfigFilePath)</FinalOutputPath>
</BuiltProjectOutputGroupOutput>
<Content Include="prefercliruntime">
<Pack>true</Pack>
<PackagePath>\prefercliruntime</PackagePath>

View file

@ -22,6 +22,14 @@ namespace Microsoft.DotNet.Cli.Utils
if(PrefersCliRuntime(commandPath))
{
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();

View file

@ -21,6 +21,8 @@ namespace Microsoft.DotNet.Cli.Utils
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}.";