diff --git a/makefiles/Makefile.dotnet.mk b/makefiles/Makefile.dotnet.mk
index e635bc8a9b..ef3ababfd6 100644
--- a/makefiles/Makefile.dotnet.mk
+++ b/makefiles/Makefile.dotnet.mk
@@ -331,6 +331,10 @@ $(LIB_DIR)/$(OR_TOOLS_NATIVE_LIB).$(SWIG_DOTNET_LIB_SUFFIX): \
$(SRC_DIR)/ortools/dotnet/orLogo.png: $(SRC_DIR)/tools/doc/orLogo.png
$(COPY) $(SRC_DIR)$Stools$Sdoc$SorLogo.png $(SRC_DIR)$Sortools$Sdotnet$SorLogo.png
+$(SRC_DIR)/ortools/dotnet/Directory.Build.props: $(SRC_DIR)/ortools/dotnet/Directory.Build.props.in
+ $(COPY) $(SRC_DIR)$Sortools$Sdotnet$SDirectory.Build.props.in $(SRC_DIR)$Sortools$Sdotnet$SDirectory.Build.props
+ $(SED) -i -e 's/@DOTNET_PACKAGES_DIR@/..\/..\/..\/packages/g' $(SRC_DIR)$Sortools$Sdotnet$SDirectory.Build.props
+
$(SRC_DIR)/ortools/dotnet/$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME)/$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME).csproj: \
$(SRC_DIR)/ortools/dotnet/$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME)/$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME).csproj.in
$(SED) -e "s/@PROJECT_VERSION@/$(OR_TOOLS_VERSION)/" \
@@ -338,7 +342,14 @@ $(SRC_DIR)/ortools/dotnet/$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME)/$(OR_TOOLS_RUNTIME_A
> ortools$Sdotnet$S$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME)$S$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME).csproj
$(DOTNET_ORTOOLS_NATIVE_NUPKG): \
+ $(SED) -i -e 's/@DOTNET_PACKAGES_DIR@/..\/..\/..\/packages/' \
+ ortools$Sdotnet$S$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME)$S$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME).csproj
+ $(SED) -i -e 's/@native@/..\/..\/..\/lib\/$(OR_TOOLS_NATIVE_LIB).$(SWIG_DOTNET_LIB_SUFFIX)/' \
+ ortools$Sdotnet$S$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME)$S$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME).csproj
+ $(SED) -i -e 's/@ortools@/..\/..\/..\/lib\/$(LIB_PREFIX)ortools.$L;..\/..\/..\/dependencies\/install\/lib*\/*.$L*/' \
+ ortools$Sdotnet$S$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME)$S$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME).csproj
$(LIB_DIR)/$(OR_TOOLS_NATIVE_LIB).$(SWIG_DOTNET_LIB_SUFFIX) \
+ $(SRC_DIR)/ortools/dotnet/Directory.Build.props \
$(SRC_DIR)/ortools/dotnet/orLogo.png \
$(SRC_DIR)/ortools/dotnet/$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME)/$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME).csproj \
$(SRC_DIR)/ortools/constraint_solver/csharp/IntVarArrayHelper.cs \
@@ -381,6 +392,8 @@ $(SRC_DIR)/ortools/dotnet/$(OR_TOOLS_ASSEMBLY_NAME)/$(OR_TOOLS_ASSEMBLY_NAME).cs
$(SED) -e "s/@PROJECT_VERSION@/$(OR_TOOLS_VERSION)/" \
ortools$Sdotnet$S$(OR_TOOLS_ASSEMBLY_NAME)$S$(OR_TOOLS_ASSEMBLY_NAME).csproj.in \
> ortools$Sdotnet$S$(OR_TOOLS_ASSEMBLY_NAME)$S$(OR_TOOLS_ASSEMBLY_NAME).csproj
+ $(SED) -i -e 's/@DOTNET_PACKAGES_DIR@/..\/..\/..\/packages/' \
+ ortools$Sdotnet$S$(OR_TOOLS_ASSEMBLY_NAME)$S$(OR_TOOLS_ASSEMBLY_NAME).csproj
# Pack managed project nuget
$(DOTNET_ORTOOLS_NUPKG): \
@@ -402,6 +415,8 @@ $(SRC_DIR)/ortools/dotnet/$(OR_TOOLS_FSHARP_ASSEMBLY_NAME)/$(OR_TOOLS_FSHARP_ASS
$(SED) -e "s/@PROJECT_VERSION@/$(OR_TOOLS_VERSION)/" \
ortools$Sdotnet$S$(OR_TOOLS_FSHARP_ASSEMBLY_NAME)$S$(OR_TOOLS_FSHARP_ASSEMBLY_NAME).fsproj.in \
> ortools$Sdotnet$S$(OR_TOOLS_FSHARP_ASSEMBLY_NAME)$S$(OR_TOOLS_FSHARP_ASSEMBLY_NAME).fsproj
+ $(SED) -i -e 's/@DOTNET_PACKAGES_DIR@/..\/..\/..\/packages/' \
+ ortools$Sdotnet$S$(OR_TOOLS_FSHARP_ASSEMBLY_NAME)$S$(OR_TOOLS_FSHARP_ASSEMBLY_NAME).fsproj
# build and pack nuget
$(DOTNET_ORTOOLS_FSHARP_NUPKG): \
@@ -417,6 +432,8 @@ ortools/dotnet/$(OR_TOOLS_FSHARP_TESTS_ASSEMBLY_NAME)/$(OR_TOOLS_FSHARP_TESTS_AS
$(SED) -e "s/@PROJECT_VERSION@/$(OR_TOOLS_VERSION)/" \
ortools$Sdotnet$S$(OR_TOOLS_FSHARP_TESTS_ASSEMBLY_NAME)$S$(OR_TOOLS_FSHARP_TESTS_ASSEMBLY_NAME).fsproj.in \
> ortools$Sdotnet$S$(OR_TOOLS_FSHARP_TESTS_ASSEMBLY_NAME)$S$(OR_TOOLS_FSHARP_TESTS_ASSEMBLY_NAME).fsproj
+ $(SED) -i -e 's/@DOTNET_PACKAGES_DIR@/..\/..\/..\/packages/' \
+ ortools$Sdotnet$S$(OR_TOOLS_FSHARP_TESTS_ASSEMBLY_NAME)$S$(OR_TOOLS_FSHARP_TESTS_ASSEMBLY_NAME).fsproj
.PHONY: test_dotnet_fsharp # Run F# OrTools Tests
test_dotnet_fsharp: $(DOTNET_ORTOOLS_FSHARP_NUPKG) \
@@ -699,6 +716,7 @@ clean_dotnet:
-$(DELREC) ortools$Sdotnet$SCreateSigningKey$Sobj
-$(DEL) $(DOTNET_ORTOOLS_SNK_PATH)
-$(DEL) ortools$Sdotnet$SorLogo.png
+ -$(DEL) ortools$Sdotnet$SDirectory.Build.props
-$(DEL) ortools$Sdotnet$S$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME)$S$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME)*.csproj
-$(DELREC) ortools$Sdotnet$S$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME)$Sbin
-$(DELREC) ortools$Sdotnet$S$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME)$Sobj
diff --git a/ortools/dotnet/Directory.Build.props b/ortools/dotnet/Directory.Build.props.in
similarity index 95%
rename from ortools/dotnet/Directory.Build.props
rename to ortools/dotnet/Directory.Build.props.in
index 90c0bad626..169a3dd553 100644
--- a/ortools/dotnet/Directory.Build.props
+++ b/ortools/dotnet/Directory.Build.props.in
@@ -17,7 +17,7 @@
https://developers.google.com/optimization
Apache-2.0
false
- ../../../packages
+ @DOTNET_PACKAGES_DIR@
false
git
https://github.com/google/or-tools
diff --git a/ortools/dotnet/Google.OrTools.FSharp.Tests/Google.OrTools.FSharp.Tests.fsproj.in b/ortools/dotnet/Google.OrTools.FSharp.Tests/Google.OrTools.FSharp.Tests.fsproj.in
index 6c2da8af20..cb68a31b49 100644
--- a/ortools/dotnet/Google.OrTools.FSharp.Tests/Google.OrTools.FSharp.Tests.fsproj.in
+++ b/ortools/dotnet/Google.OrTools.FSharp.Tests/Google.OrTools.FSharp.Tests.fsproj.in
@@ -7,7 +7,7 @@
Google.OrTools.FSharp.Tests
false
- ../../../packages;$(RestoreSources);https://api.nuget.org/v3/index.json
+ @DOTNET_PACKAGES_DIR@;$(RestoreSources);https://api.nuget.org/v3/index.json
diff --git a/ortools/dotnet/Google.OrTools.FSharp/Google.OrTools.FSharp.fsproj.in b/ortools/dotnet/Google.OrTools.FSharp/Google.OrTools.FSharp.fsproj.in
index 539ce069fc..1d1bb67cd9 100644
--- a/ortools/dotnet/Google.OrTools.FSharp/Google.OrTools.FSharp.fsproj.in
+++ b/ortools/dotnet/Google.OrTools.FSharp/Google.OrTools.FSharp.fsproj.in
@@ -39,7 +39,7 @@
- ../../../packages;$(RestoreSources);https://api.nuget.org/v3/index.json
+ @DOTNET_PACKAGES_DIR@;$(RestoreSources);https://api.nuget.org/v3/index.json
diff --git a/ortools/dotnet/Google.OrTools.runtime.linux-x64/Google.OrTools.runtime.linux-x64.csproj.in b/ortools/dotnet/Google.OrTools.runtime.linux-x64/Google.OrTools.runtime.linux-x64.csproj.in
index 5b61ec829b..8ad79be929 100644
--- a/ortools/dotnet/Google.OrTools.runtime.linux-x64/Google.OrTools.runtime.linux-x64.csproj.in
+++ b/ortools/dotnet/Google.OrTools.runtime.linux-x64/Google.OrTools.runtime.linux-x64.csproj.in
@@ -23,12 +23,12 @@
-
+
runtimes/linux-x64/native/%(Filename)%(Extension)
true
PreserveNewest
-
+
runtimes/linux-x64/native/%(Filename)%(Extension)
true
PreserveNewest
diff --git a/ortools/dotnet/Google.OrTools.runtime.osx-x64/Google.OrTools.runtime.osx-x64.csproj.in b/ortools/dotnet/Google.OrTools.runtime.osx-x64/Google.OrTools.runtime.osx-x64.csproj.in
index 484a3287c2..8445d9317d 100644
--- a/ortools/dotnet/Google.OrTools.runtime.osx-x64/Google.OrTools.runtime.osx-x64.csproj.in
+++ b/ortools/dotnet/Google.OrTools.runtime.osx-x64/Google.OrTools.runtime.osx-x64.csproj.in
@@ -23,12 +23,12 @@
-
+
runtimes/osx-x64/native/%(Filename)%(Extension)
true
PreserveNewest
-
+
runtimes/osx-x64/native/%(Filename)%(Extension)
true
PreserveNewest
diff --git a/ortools/dotnet/Google.OrTools.runtime.win-x64/Google.OrTools.runtime.win-x64.csproj.in b/ortools/dotnet/Google.OrTools.runtime.win-x64/Google.OrTools.runtime.win-x64.csproj.in
index 866df1edf0..a4bbd08a93 100644
--- a/ortools/dotnet/Google.OrTools.runtime.win-x64/Google.OrTools.runtime.win-x64.csproj.in
+++ b/ortools/dotnet/Google.OrTools.runtime.win-x64/Google.OrTools.runtime.win-x64.csproj.in
@@ -24,7 +24,7 @@
-
+
runtimes/win-x64/native/%(Filename)%(Extension)
true
PreserveNewest
diff --git a/ortools/dotnet/Google.OrTools/Google.OrTools.csproj.in b/ortools/dotnet/Google.OrTools/Google.OrTools.csproj.in
index 6b2ab1ba74..eb59706e3d 100644
--- a/ortools/dotnet/Google.OrTools/Google.OrTools.csproj.in
+++ b/ortools/dotnet/Google.OrTools/Google.OrTools.csproj.in
@@ -73,9 +73,9 @@
-
-
-
+
+
+
@@ -142,15 +142,15 @@
- ../../../packages;$(RestoreSources);https://api.nuget.org/v3/index.json
+ @DOTNET_PACKAGES_DIR@;$(RestoreSources);https://api.nuget.org/v3/index.json
-
+
-
+
-
+