Search code examples
visual-studiobatch-processing

Automated alternative to Visual Studio's batch build?


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?


Solution

  • 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