Remove NuGet.config from the default dotnet new drop. Patch the tests to cover this gap until corefx is on nuget.org

This commit is contained in:
Bryan Thornbury 2016-04-06 14:34:39 -07:00
parent 584fdea49e
commit 939366165f
3 changed files with 19 additions and 10 deletions

View file

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
<clear />
<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>

View file

@ -3,7 +3,6 @@
<packageSources>
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
<clear />
<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="fsharp-daily" value="https://www.myget.org/F/fsharp-daily/api/v3/index.json" />

View file

@ -207,6 +207,7 @@ namespace Microsoft.DotNet.Tests.EndToEnd
catch(Exception) {}
Directory.CreateDirectory(RestoredTestProjectDirectory);
WriteNuGetConfig(RestoredTestProjectDirectory);
var currentDirectory = Directory.GetCurrentDirectory();
Directory.SetCurrentDirectory(RestoredTestProjectDirectory);
@ -243,6 +244,24 @@ namespace Microsoft.DotNet.Tests.EndToEnd
return isSupported;
}
// Todo: this is a hack until corefx is on nuget.org remove this After RC 2 Release
private static void WriteNuGetConfig(string directory)
{
var contents = @"<?xml version=""1.0"" encoding=""utf-8""?>
<configuration>
<packageSources>
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
<clear />
<add key=""dotnet-core"" value=""https://dotnet.myget.org/F/dotnet-core/api/v3/index.json"" />
<add key=""api.nuget.org"" value=""https://api.nuget.org/v3/index.json"" />
</packageSources>
</configuration>";
var path = Path.Combine(directory, "NuGet.config");
File.WriteAllText(path, contents);
}
private static DateTime GetLastWriteTimeUtcOfDirectoryFiles(string outputDirectory)
{
return Directory.EnumerateFiles(outputDirectory).Max(f => File.GetLastWriteTimeUtc(f));