about summary refs log tree commit diff
path: root/pkgs/build-support/dotnet
diff options
context:
space:
mode:
authormdarocha <git@mdarocha.pl>2022-11-25 02:45:05 +0100
committermdarocha <git@mdarocha.pl>2022-11-25 18:50:44 +0100
commit8e7296e984b6a4627ff04c4337a28933a442d95a (patch)
tree3a383461f08c3f67f952902a5393cac28af16c73 /pkgs/build-support/dotnet
parentdcaa4a9982eede1b0e8f9e5bc515c8e21c492f42 (diff)
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.
Diffstat (limited to 'pkgs/build-support/dotnet')
-rw-r--r--pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-configure-hook.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-configure-hook.sh b/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-configure-hook.sh
index 10067cf088244..3479f58bb38c5 100644
--- a/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-configure-hook.sh
+++ b/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-configure-hook.sh
@@ -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