Fix FunctionalTests on fresh system
This commit is contained in:
parent
9f5b1aa18a
commit
74229e57db
|
|
@ -36,3 +36,4 @@ testWorkDir/
|
||||||
.dotnet/
|
.dotnet/
|
||||||
global.json
|
global.json
|
||||||
*.binlog
|
*.binlog
|
||||||
|
test/dotnet-watch.FunctionalTests/TestProjects/NuGet.config
|
||||||
|
|
@ -35,7 +35,10 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests
|
||||||
CreateTestDirectory();
|
CreateTestDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string TempFolder { get; } = Path.Combine(Path.GetDirectoryName(FindNugetConfig()), "testWorkDir", Guid.NewGuid().ToString("N"));
|
|
||||||
|
public static string TestWorkFolder { get; } = Path.Combine(AppContext.BaseDirectory, "testWorkDir");
|
||||||
|
|
||||||
|
public string TempFolder { get; } = Path.Combine(TestWorkFolder, Guid.NewGuid().ToString("N"));
|
||||||
|
|
||||||
public string WorkFolder { get; }
|
public string WorkFolder { get; }
|
||||||
|
|
||||||
|
|
@ -154,7 +157,7 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests
|
||||||
|
|
||||||
private static string FindNugetConfig()
|
private static string FindNugetConfig()
|
||||||
{
|
{
|
||||||
var currentDirPath = AppContext.BaseDirectory;
|
var currentDirPath = TestWorkFolder;
|
||||||
|
|
||||||
string nugetConfigFile;
|
string nugetConfigFile;
|
||||||
while (true)
|
while (true)
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,32 @@
|
||||||
<PackageReference Include="Microsoft.Extensions.CommandLineUtils.Sources" PrivateAssets="All" Version="$(MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion)" />
|
<PackageReference Include="Microsoft.Extensions.CommandLineUtils.Sources" PrivateAssets="All" Version="$(MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<Target Name="GenerateRestoreSourcesFile" BeforeTargets="Compile">
|
||||||
|
<PropertyGroup>
|
||||||
|
<RestoreSourcesFile>$(MSBuildThisFileDirectory)/TestProjects/NuGet.config</RestoreSourcesFile>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<CreateItem Include="$(RestoreSources)">
|
||||||
|
<Output TaskParameter="Include" ItemName="RestoreSourcesItems"/>
|
||||||
|
</CreateItem>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<NuGetConfigLines Include="<?xml version="1.0" encoding="utf-8"?>" />
|
||||||
|
<NuGetConfigLines Include="<configuration>" />
|
||||||
|
<NuGetConfigLines Include="<packageSources>" />
|
||||||
|
<NuGetConfigLines Include="<clear/>" />
|
||||||
|
<NuGetConfigLines Include="<add key="%(RestoreSourcesItems.Identity)" value="%(RestoreSourcesItems.Identity)" />" />
|
||||||
|
<NuGetConfigLines Include="</packageSources>" />
|
||||||
|
<NuGetConfigLines Include="</configuration>" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<WriteLinesToFile
|
||||||
|
File="$(RestoreSourcesFile)"
|
||||||
|
Lines="@(NuGetConfigLines)"
|
||||||
|
Overwrite="true"
|
||||||
|
Encoding="UTF-8" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
<Target Name="CleanTestProjects" BeforeTargets="CoreCompile">
|
<Target Name="CleanTestProjects" BeforeTargets="CoreCompile">
|
||||||
<RemoveDir Directories="$(TargetDir)TestProjects" Condition="Exists('$(TargetDir)TestProjects')" />
|
<RemoveDir Directories="$(TargetDir)TestProjects" Condition="Exists('$(TargetDir)TestProjects')" />
|
||||||
</Target>
|
</Target>
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,7 @@ namespace Microsoft.DotNet.Watcher.Tools.Tests
|
||||||
.SubDir("src")
|
.SubDir("src")
|
||||||
.SubDir("Project1")
|
.SubDir("Project1")
|
||||||
.WithCSharpProject("Project1", out var target)
|
.WithCSharpProject("Project1", out var target)
|
||||||
|
.WithProperty("BaseIntermediateOutputPath", "obj")
|
||||||
.WithTargetFrameworks("netcoreapp1.0")
|
.WithTargetFrameworks("netcoreapp1.0")
|
||||||
.Dir()
|
.Dir()
|
||||||
.WithFile("Program.cs")
|
.WithFile("Program.cs")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue