buildDotnetModule: generate a NuGet.config with source

Some references, like <Sdk />, ignore the --source argument.
To fix that, we generate a simple NuGet.config containing only
the given nuget source.
This commit is contained in:
mdarocha 2022-11-25 02:45:05 +01:00
parent dcaa4a9982
commit 8e7296e984

View file

@ -26,6 +26,18 @@ dotnetConfigureHook() {
(( "${#projectFile[@]}" == 0 )) && dotnetRestore
# Generate a NuGet.config file to make sure everything,
# including things like <Sdk /> dependencies, is restored from the proper source
cat <<EOF > "./NuGet.config"
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="nugetSource" value="@nugetSource@/lib" />
</packageSources>
</configuration>
EOF
for project in ${projectFile[@]} ${testProjectFile[@]-}; do
dotnetRestore "$project"
done