From e8795ff105f09747ce579632e81f80d7be19aa91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Ga=C3=9Fmann?= Date: Fri, 19 May 2017 16:44:44 +0200 Subject: [PATCH] [.NET Core] SUPPORT .NET FRAMEWORK >= 4.6 (#547) Add MSBuild targets for net46 target framework which copy both x86 and x64 libsodium binaries into corresponding folders. This allows AnyCPU applications to load the appropriate binary at runtime via `LoadLibraryEx`. --- packaging/dotnet-core/desktop.targets | 16 ++++++++++++++++ packaging/dotnet-core/libsodium.props | 3 ++- packaging/dotnet-core/prepare.py | 8 ++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 packaging/dotnet-core/desktop.targets diff --git a/packaging/dotnet-core/desktop.targets b/packaging/dotnet-core/desktop.targets new file mode 100644 index 00000000..b117c478 --- /dev/null +++ b/packaging/dotnet-core/desktop.targets @@ -0,0 +1,16 @@ + + + + x86\libsodium.dll + PreserveNewest + PreserveNewest + false + + + x64\libsodium.dll + PreserveNewest + PreserveNewest + false + + + \ No newline at end of file diff --git a/packaging/dotnet-core/libsodium.props b/packaging/dotnet-core/libsodium.props index 7fc4c00a..96a0fc1b 100644 --- a/packaging/dotnet-core/libsodium.props +++ b/packaging/dotnet-core/libsodium.props @@ -1,7 +1,7 @@ - netstandard1.1 + netstandard1.1;net46 true true false @@ -23,5 +23,6 @@ + diff --git a/packaging/dotnet-core/prepare.py b/packaging/dotnet-core/prepare.py index 146c6238..4eb3fa24 100644 --- a/packaging/dotnet-core/prepare.py +++ b/packaging/dotnet-core/prepare.py @@ -42,6 +42,7 @@ LINUX = [ EXTRAS = [ 'LICENSE', 'AUTHORS', 'ChangeLog' ] PROPSFILE = 'libsodium.props' +DESKTOPTARGETSFILE = 'desktop.targets' MAKEFILE = 'Makefile' BUILDDIR = 'build' CACHEDIR = 'cache' @@ -64,6 +65,7 @@ class Version: self.projfile = os.path.join(self.builddir, '{0}.pkgproj'.format(PACKAGE)) self.propsfile = os.path.join(self.builddir, '{0}.props'.format(PACKAGE)) self.pkgfile = os.path.join(BUILDDIR, '{0}.{1}.nupkg'.format(PACKAGE, self.version)) + self.desktoptargetsfile = os.path.join(self.builddir, 'build', 'net46', '{0}.targets'.format(PACKAGE)) class WindowsItem: @@ -202,6 +204,11 @@ def main(args): for item in items: item.make(f) + f.write('\n') + f.write('{0}: {1}\n'.format(version.desktoptargetsfile, DESKTOPTARGETSFILE)) + f.write('\t@mkdir -p $(dir $@)\n') + f.write('\tcp -f $< $@\n') + f.write('\n') f.write('{0}: {1}\n'.format(version.propsfile, PROPSFILE)) f.write('\t@mkdir -p $(dir $@)\n') @@ -222,6 +229,7 @@ def main(args): f.write('{0}:'.format(version.pkgfile)) f.write(' \\\n\t\t{0}'.format(version.projfile)) f.write(' \\\n\t\t{0}'.format(version.propsfile)) + f.write(' \\\n\t\t{0}'.format(version.desktoptargetsfile)) for item in items: f.write(' \\\n\t\t{0}'.format(item.packfile)) f.write('\n')