I have a managed library that wraps a native library which has binaries for both 32-bit and 64-bit.
Currently, I have to do the following:
First, build the native library 32-bit and 64-bit builds using Batch Build.
Second, build the managed library.
The managed library references binaries which are then loaded using NativeLibrary.Load at runtime.
The whole thing ends up as a NuGet package ready for consumption.
Question:
How can I get that batch build step to be performed automatically instead of manually?
CodePudding user response:
I don't believe VS has the ability to directly have a project depend on multiple platform builds of a different project. It's possible to make an x64 project depend on an x86 build but not, as far as I am aware, have it depend on both x86 and x64 builds of a single project.
You could, however, add a duplicate project. That is, have your dependency rely on x86 build of foo_x86 and x64 of foo_x64, with foo_x86 and foo_x64 actually building from the same files. It may even be possible to have foo-_x86 and foo_x64 actually use the same project file. That last I am simply not sure about.
CodePudding user response:
Using <MSBuild Projects=.../>
just works, the key in getting this to work is:
- get the projects to compile through command-line to figure out missing parameters
- not as straightforward as it sounds as Visual Studio does a lot under the hood
- finally, pass the required parameters to
<MsBuild>
, e.g.OutDir
for instance