diff --git a/TestAssets/TestPackages/ToolWithOutputName/ToolWithOutputName.csproj b/TestAssets/TestPackages/ToolWithOutputName/ToolWithOutputName.csproj index 5639e3331..6c57ebe5d 100644 --- a/TestAssets/TestPackages/ToolWithOutputName/ToolWithOutputName.csproj +++ b/TestAssets/TestPackages/ToolWithOutputName/ToolWithOutputName.csproj @@ -8,10 +8,4 @@ Exe - - - $(ProjectRuntimeConfigFilePath) - - - diff --git a/TestAssets/TestPackages/dotnet-dependency-context-test/dotnet-dependency-context-test.csproj b/TestAssets/TestPackages/dotnet-dependency-context-test/dotnet-dependency-context-test.csproj index 85afeaf74..97e20d00d 100644 --- a/TestAssets/TestPackages/dotnet-dependency-context-test/dotnet-dependency-context-test.csproj +++ b/TestAssets/TestPackages/dotnet-dependency-context-test/dotnet-dependency-context-test.csproj @@ -7,12 +7,6 @@ Exe - - - $(ProjectRuntimeConfigFilePath) - - - diff --git a/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj b/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj index 2ce9e3b1a..47539b5f0 100644 --- a/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj +++ b/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj @@ -20,12 +20,6 @@ - - - $(ProjectRuntimeConfigFilePath) - - - diff --git a/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj b/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj index 1f3345bf4..185ef41f0 100644 --- a/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj +++ b/TestAssets/TestPackages/dotnet-desktop-and-portable/dotnet-desktop-and-portable.csproj @@ -9,12 +9,6 @@ win7-x64;win7-x86 - - - $(ProjectRuntimeConfigFilePath) - - - 1.1.1 diff --git a/TestAssets/TestPackages/dotnet-fallbackfoldertool/dotnet-fallbackfoldertool.csproj b/TestAssets/TestPackages/dotnet-fallbackfoldertool/dotnet-fallbackfoldertool.csproj index 11aac9cf0..35e92a2bb 100644 --- a/TestAssets/TestPackages/dotnet-fallbackfoldertool/dotnet-fallbackfoldertool.csproj +++ b/TestAssets/TestPackages/dotnet-fallbackfoldertool/dotnet-fallbackfoldertool.csproj @@ -7,10 +7,5 @@ Exe - - - - $(ProjectRuntimeConfigFilePath) - - + diff --git a/TestAssets/TestPackages/dotnet-outputsframeworkversion/dotnet-outputsframeworkversion-netcoreapp1.0/dotnet-outputsframeworkversion-netcoreapp1.0.csproj b/TestAssets/TestPackages/dotnet-outputsframeworkversion/dotnet-outputsframeworkversion-netcoreapp1.0/dotnet-outputsframeworkversion-netcoreapp1.0.csproj index 17c0af923..e26afd464 100644 --- a/TestAssets/TestPackages/dotnet-outputsframeworkversion/dotnet-outputsframeworkversion-netcoreapp1.0/dotnet-outputsframeworkversion-netcoreapp1.0.csproj +++ b/TestAssets/TestPackages/dotnet-outputsframeworkversion/dotnet-outputsframeworkversion-netcoreapp1.0/dotnet-outputsframeworkversion-netcoreapp1.0.csproj @@ -7,9 +7,4 @@ Exe 1.1.1 - - - $(ProjectRuntimeConfigFilePath) - - diff --git a/TestAssets/TestPackages/dotnet-portable-v1-prefercli/dotnet-portable-v1-prefercli.csproj b/TestAssets/TestPackages/dotnet-portable-v1-prefercli/dotnet-portable-v1-prefercli.csproj index 60ef7f71c..10cc9b117 100644 --- a/TestAssets/TestPackages/dotnet-portable-v1-prefercli/dotnet-portable-v1-prefercli.csproj +++ b/TestAssets/TestPackages/dotnet-portable-v1-prefercli/dotnet-portable-v1-prefercli.csproj @@ -14,10 +14,5 @@ - - - true - \prefercliruntime - diff --git a/TestAssets/TestPackages/dotnet-portable-v1/dotnet-portable-v1.csproj b/TestAssets/TestPackages/dotnet-portable-v1/dotnet-portable-v1.csproj index 3df959be1..b1bddfee9 100644 --- a/TestAssets/TestPackages/dotnet-portable-v1/dotnet-portable-v1.csproj +++ b/TestAssets/TestPackages/dotnet-portable-v1/dotnet-portable-v1.csproj @@ -6,12 +6,6 @@ Exe - - - $(ProjectRuntimeConfigFilePath) - - - diff --git a/TestAssets/TestPackages/dotnet-portable/dotnet-portable.csproj b/TestAssets/TestPackages/dotnet-portable/dotnet-portable.csproj index f8b581110..bc2925f73 100644 --- a/TestAssets/TestPackages/dotnet-portable/dotnet-portable.csproj +++ b/TestAssets/TestPackages/dotnet-portable/dotnet-portable.csproj @@ -6,9 +6,4 @@ Exe - - - $(ProjectRuntimeConfigFilePath) - - diff --git a/TestAssets/TestPackages/dotnet-prefercliruntime/dotnet-prefercliruntime.csproj b/TestAssets/TestPackages/dotnet-prefercliruntime/dotnet-prefercliruntime.csproj index bd65e4cdd..21eb0a6d1 100644 --- a/TestAssets/TestPackages/dotnet-prefercliruntime/dotnet-prefercliruntime.csproj +++ b/TestAssets/TestPackages/dotnet-prefercliruntime/dotnet-prefercliruntime.csproj @@ -8,10 +8,6 @@ - - $(ProjectRuntimeConfigFilePath) - - true \prefercliruntime diff --git a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/PackagedCommandSpecFactoryWithCliRuntime.cs b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/PackagedCommandSpecFactoryWithCliRuntime.cs index 0d7edc4e3..c22af40ba 100644 --- a/src/Microsoft.DotNet.Cli.Utils/CommandResolution/PackagedCommandSpecFactoryWithCliRuntime.cs +++ b/src/Microsoft.DotNet.Cli.Utils/CommandResolution/PackagedCommandSpecFactoryWithCliRuntime.cs @@ -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(); diff --git a/src/Microsoft.DotNet.Cli.Utils/LocalizableStrings.cs b/src/Microsoft.DotNet.Cli.Utils/LocalizableStrings.cs index 455920e1b..3b2f17829 100644 --- a/src/Microsoft.DotNet.Cli.Utils/LocalizableStrings.cs +++ b/src/Microsoft.DotNet.Cli.Utils/LocalizableStrings.cs @@ -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}.";