Use packageSourceMapping to control source of NuGet packages
Contrary to common-sense, NuGet package sources are not ordered. Thus, the existence of nuget_official.config is pointless as it was an attempt to prefer already published .nupkgs over newly built .nupkgs in post-GA builds. Instead, NuGet introduced packageSourceMapping which is a more powerful solution to address post-GA package resolution.
Rob Mensching committed
Sep 30, 2022 at 23:48 UTC
ed6593322d34ff0e655be9347f340d0cc96c0784
4 files changed
+11
-16
nuget.config
+10
-1
@@ -7,6 +7,15 @@
7
<clear />
8
<add key="nuget" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
9
<add key="build" value="build\artifacts" />
10
- <!-- <add key="github" value="https://nuget.pkg.github.com/wixtoolset/UnifiedTest1/index.json" /> -->
10
</packageSources>
11
+
12
+ <packageSourceMapping>
13
+ <packageSource key="nuget">
14
+ <package pattern="*" />
15
+ </packageSource>
16
+ <packageSource key="build">
17
+ <package pattern="WixToolset.*" />
18
+ <package pattern="WixBuildTools.*" />
19
+ </packageSource>
20
+ </packageSourceMapping>
21
</configuration>
src/Directory.Build.props
+1
-1
@@ -6,7 +6,7 @@
6
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
7
<EnableSourceLink Condition=" '$(NCrunch)' == '1' ">false</EnableSourceLink>
8
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
9
- <NoWarn>$(NoWarn);NU1507;MSB3026</NoWarn>
9
+ <NoWarn>$(NoWarn);MSB3026</NoWarn>
10
11
<ProjectName Condition=" '$(ProjectName)' == '' ">$(MSBuildProjectName)</ProjectName>
12
<RootBuildFolder>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\build\))</RootBuildFolder>
src/build_official.cmd
-2
@@ -1,8 +1,6 @@
1
@setlocal
2
@pushd %~dp0
3
4
-@copy nuget_official.config ..\nuget.config
5
-
4
build_all.cmd Release Official
5
6
@popd
src/nuget_official.config
deleted
-12
@@ -1,12 +0,0 @@
1
-<?xml version="1.0" encoding="utf-8"?>
2
-<configuration>
3
- <config>
4
- <add key="repositoryPath" value="packages" />
5
- </config>
6
- <packageSources>
7
- <clear />
8
- <add key="nuget" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
9
- <!-- <add key="github" value="https://nuget.pkg.github.com/wixtoolset/UnifiedTest1/index.json" /> -->
10
- <add key="build" value="build\artifacts" />
11
- </packageSources>
12
-</configuration>