<Project ToolsVersion="15.0">
  <Target Name="WriteNugetConfigFile">

      <ItemGroup>
        <NugetConfigPrivateFeeds Include="$(ExternalRestoreSources.Split(';'))" />
      </ItemGroup>

    <PropertyGroup>
      <NugetConfigHeader>
        <![CDATA[
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
<clear />
        ]]>
      </NugetConfigHeader>

      <NugetConfigCLIFeeds>
        <![CDATA[
    <add key="myget-vstest" value="https://dotnet.myget.org/F/vstest/api/v3/index.json" />
    <add key="BlobFeed" value="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" />
    <add key="aspnetcore-release" value="https://dotnet.myget.org/F/aspnetcore-release/api/v3/index.json" />
    <add key="aspnetcore-dev" value="https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json" />
    <add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
    <add key="templating" value="https://dotnet.myget.org/F/templating/api/v3/index.json" />
  	<add key="websdk" value="https://dotnet.myget.org/F/dotnet-web/api/v3/index.json" />
    <add key="roslyn" value="https://dotnet.myget.org/f/roslyn/api/v3/index.json" />
    <add key="nuget-build" value="https://dotnet.myget.org/F/nuget-build/api/v3/index.json" />
    <add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
    <add key="container-tools" value="https://www.myget.org/F/container-tools-for-visual-studio/api/v3/index.json" />
    <add key="linux-musl-bootstrap-feed" value="https://dotnetfeed.blob.core.windows.net/orchestrated-release-2-1/20180420-03/aspnet-inputs/index.json" />
    <add key="dotnet-msbuild" value="https://dotnet.myget.org/F/msbuild/api/v3/index.json" />
    <add key="myget-vstest" value="https://dotnet.myget.org/F/vstest/api/v3/index.json" />
    <add key="BlobFeed-2.1.3-runtime" value="https://dotnetfeed.blob.core.windows.net/orchestrated-release-2-1/20180725-02/final/index.json"/>
        ]]>
      </NugetConfigCLIFeeds>

      <NugetConfigSuffix>
        <![CDATA[
</packageSources>
<disabledPackageSources>
   <clear/>
</disabledPackageSources>
</configuration>
        ]]>
      </NugetConfigSuffix>

  </PropertyGroup>

    <WriteLinesToFile File="$(GeneratedNuGetConfig)"
                      Lines="$(NugetConfigHeader)"
                      Overwrite="true" />

    <WriteLinesToFile Condition="'$(ExternalRestoreSources)' != ''"
                      File="$(GeneratedNuGetConfig)"
                      Lines="&lt;add key=&quot;PrivateBlobFeed%(NugetConfigPrivateFeeds.Identity)&quot; value=&quot;%(NugetConfigPrivateFeeds.Identity)&quot; /&gt;"
                      Overwrite="false" />

    <WriteLinesToFile Condition="'$(DotNetBuildOffline)' != 'true'"
                      File="$(GeneratedNuGetConfig)"
                      Lines="$(NugetConfigCLIFeeds)"
                      Overwrite="false" />

    <WriteLinesToFile File="$(GeneratedNuGetConfig)"
                      Lines="$(NugetConfigSuffix)"
                      Overwrite="false" />

  </Target>
</Project>
