Writing a NuGet.config as part of the preparatory steps.

This commit is contained in:
John Beisner 2017-11-28 12:54:32 -08:00
parent e303461ab6
commit e7f4fb001b
6 changed files with 67 additions and 24 deletions

View file

@ -1,20 +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="TransportFeed" value="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" />
<add key="templating" value="https://dotnet.myget.org/F/templating/api/v3/index.json" />
<add key="aspnet" value="https://dotnet.myget.org/F/aspnetcore-release/api/v3/index.json" />
<add key="websdkfeed" value="https://dotnet.myget.org/F/dotnet-web/api/v3/index.json" />
<add key="cli-deps" value="https://dotnet.myget.org/F/cli-deps/api/v3/index.json" />
<add key="roslyn" value="https://dotnet.myget.org/f/roslyn/api/v3/index.json" />
<add key="symreader-native" value="https://dotnet.myget.org/f/symreader-native/api/v3/index.json" />
<add key="xunit" value="https://www.myget.org/F/xunit/api/v3/index.json" />
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="vstest" value="https://dotnet.myget.org/F/vstest/api/v3/index.json" />
<add key="web-api" value="https://dotnet.myget.org/F/dotnet-web/api/v3/index.json" />
<add key="symreader-native" value="https://dotnet.myget.org/F/symreader-native/api/v3/index.json" />
<add key="AspNetMaster" value="https://dotnet.myget.org/F/aspnetcore-master/api/v3/index.json" />
</packageSources>
</configuration>

View file

@ -29,10 +29,11 @@
<RestoreDotnetCliBuildFrameworkOutputs Include="$(DotnetCliBuildDirectory)/obj/dotnet-cli-build.csproj.nuget.g.props" />
<RestoreDotnetCliBuildFrameworkOutputs Include="$(DotnetCliBuildDirectory)/obj/dotnet-cli-build.csproj.nuget.g.targets" />
</ItemGroup>
<Target Name="RestoreDotnetCliBuildFramework"
Inputs="$(DotnetCliBuildDirectory)/dotnet-cli-build.csproj"
Outputs="@(RestoreDotnetCliBuildFrameworkOutputs)">
Outputs="@(RestoreDotnetCliBuildFrameworkOutputs)"
DependsOnTargets="WriteNugetConfigFile">
<PropertyGroup>
<ExtraRestoreArgs>$(ExtraRestoreArgs) /p:GeneratePropsFile=$(GeneratePropsFile)</ExtraRestoreArgs>
@ -48,6 +49,7 @@
<Import Project="build/GitCommitInfo.targets" />
<Import Project="build/HostInfo.targets" />
<Import Project="build/BuildInfo.targets" />
<Import Project="build/NugetConfigFile.targets" />
<Import Project="build/Prepare.targets" />
<Import Project="build/Compile.targets" />
<Import Project="build/Package.targets" />

View file

@ -4,5 +4,7 @@
<GitCommitInfoProps>$(GeneratedPropsDir)/GitCommitInfo.props</GitCommitInfoProps>
<HostInfoProps>$(GeneratedPropsDir)/HostInfo.props</HostInfoProps>
<BuildInfoProps>$(GeneratedPropsDir)/BuildInfo.props</BuildInfoProps>
<BuildInfoProps>$(GeneratedPropsDir)/BuildInfo.props</BuildInfoProps>
<GeneratedNuGetConfig>$(RepoRoot)/NuGet.Config</GeneratedNuGetConfig>
</PropertyGroup>
</Project>

View file

@ -1,6 +1,7 @@
<Project ToolsVersion="15.0">
<Target Name="WriteDynamicPropsToStaticPropsFiles"
DependsOnTargets="BuildDotnetCliBuildFramework;
DependsOnTargets="WriteNugetConfigFile;
BuildDotnetCliBuildFramework;
EnsureGeneratedPropsDirectory;
WriteGitCommitInfoProps;
WriteHostInfoProps;

View file

@ -0,0 +1,58 @@
<Project ToolsVersion="15.0">
<Target Name="WriteNugetConfigFile">
<PropertyGroup>
<NugetConfigHeader>
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;configuration&gt;
&lt;packageSources&gt;
&lt;!--To inherit the global NuGet package sources remove the &lt;clear/&gt; line below --&gt;
&lt;clear /&gt;
</NugetConfigHeader>
<NugetConfigFeedsPrivate>
&lt;add key=&quot;PrivateBlobFeed&quot; value=&quot;$(ExternalRestoreSources)&quot; /&gt;
</NugetConfigFeedsPrivate>
<NugetConfigFeedsNormal>
&lt;add key=&quot;BlobFeed&quot; value=&quot;https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json&quot; /&gt;
&lt;add key=&quot;templating&quot; value=&quot;https://dotnet.myget.org/F/templating/api/v3/index.json&quot; /&gt;
&lt;add key=&quot;aspnet&quot; value=&quot;https://dotnet.myget.org/F/aspnetcore-release/api/v3/index.json&quot; /&gt;
&lt;add key=&quot;websdkfeed&quot; value=&quot;https://dotnet.myget.org/F/dotnet-web/api/v3/index.json&quot; /&gt;
&lt;add key=&quot;cli-deps&quot; value=&quot;https://dotnet.myget.org/F/cli-deps/api/v3/index.json&quot; /&gt;
&lt;add key=&quot;roslyn&quot; value=&quot;https://dotnet.myget.org/f/roslyn/api/v3/index.json&quot; /&gt;
&lt;add key=&quot;symreader-native&quot; value=&quot;https://dotnet.myget.org/f/symreader-native/api/v3/index.json&quot; /&gt;
&lt;add key=&quot;xunit&quot; value=&quot;https://www.myget.org/F/xunit/api/v3/index.json&quot; /&gt;
&lt;add key=&quot;api.nuget.org&quot; value=&quot;https://api.nuget.org/v3/index.json&quot; /&gt;
&lt;add key=&quot;vstest&quot; value=&quot;https://dotnet.myget.org/F/vstest/api/v3/index.json&quot; /&gt;
&lt;add key=&quot;web-api&quot; value=&quot;https://dotnet.myget.org/F/dotnet-web/api/v3/index.json&quot; /&gt;
&lt;add key=&quot;symreader-native&quot; value=&quot;https://dotnet.myget.org/F/symreader-native/api/v3/index.json&quot; /&gt;
&lt;add key=&quot;AspNetMaster&quot; value=&quot;https://dotnet.myget.org/F/aspnetcore-master/api/v3/index.json" /&gt;
</NugetConfigFeedsNormal>
<NugetConfigSuffix>
&lt;/packageSources&gt;
&lt;/configuration&gt;
</NugetConfigSuffix>
</PropertyGroup>
<WriteLinesToFile File="$(GeneratedNuGetConfig)"
Lines="$(NugetConfigHeader)"
Overwrite="true" />
<WriteLinesToFile Condition="'$(ExternalRestoreSources)' != ''"
File="$(GeneratedNuGetConfig)"
Lines="$(NugetConfigFeedsPrivate)"
Overwrite="false" />
<WriteLinesToFile Condition="'$(DotNetBuildOffline)' != 'true'"
File="$(GeneratedNuGetConfig)"
Lines="$(NugetConfigFeedsNormal)"
Overwrite="false" />
<WriteLinesToFile File="$(GeneratedNuGetConfig)"
Lines="$(NugetConfigSuffix)"
Overwrite="false" />
</Target>
</Project>

View file

@ -106,7 +106,7 @@ if ($NoBuild)
}
else
{
dotnet msbuild build.proj /p:Architecture=$Architecture /p:GeneratePropsFile=true /t:WriteDynamicPropsToStaticPropsFiles
dotnet msbuild build.proj /p:Architecture=$Architecture /p:GeneratePropsFile=true /t:WriteDynamicPropsToStaticPropsFiles $ExtraParameters
dotnet msbuild build.proj /m /v:normal /fl /flp:v=diag /p:Architecture=$Architecture $ExtraParameters
if($LASTEXITCODE -ne 0) { throw "Failed to build" }
}