Skip to content

Change how we resolve dotnet in tests (#16934) #16949

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/Tools/dotnet-watch/test/Scenario/WatchableApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using Microsoft.Extensions.CommandLineUtils;
Expand Down Expand Up @@ -88,15 +89,19 @@ public void Start(IEnumerable<string> arguments, [CallerMemberName] string name
};
args.AddRange(arguments);

var dotnetPath = typeof(WatchableApp).Assembly.GetCustomAttributes<AssemblyMetadataAttribute>()
.Single(s => s.Key == "DotnetPath").Value;

var spec = new ProcessSpec
{
Executable = DotNetMuxer.MuxerPathOrDefault(),
Executable = dotnetPath,
Arguments = args,
WorkingDirectory = SourceDirectory,
EnvironmentVariables =
{
["DOTNET_CLI_CONTEXT_VERBOSE"] = bool.TrueString,
["DOTNET_USE_POLLING_FILE_WATCHER"] = UsePollingWatcher.ToString(),
["DOTNET_ROOT"] = Directory.GetParent(dotnetPath).FullName,
},
};

Expand Down
7 changes: 7 additions & 0 deletions src/Tools/dotnet-watch/test/dotnet-watch.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
<ProjectReference Include="..\src\dotnet-watch.csproj" />
</ItemGroup>

<ItemGroup>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
<_Parameter1>DotnetPath</_Parameter1>
<_Parameter2>$(DotNetTool)</_Parameter2>
</AssemblyAttribute>
</ItemGroup>

<Target Name="CleanTestProjects" BeforeTargets="CoreCompile">
<RemoveDir Directories="$(TargetDir)TestProjects" Condition="Exists('$(TargetDir)TestProjects')" />
</Target>
Expand Down