My setup consists of three separate projects:
- MyApp - C# application. References CLibraryWrapper (includes as a git submodule)
- CLibraryWrapper - C# class library which is a C# wrapper for native C library. Depends on CLibrary (includes it as a git submodule)
- CLibrary - C shared library.
C# platform=AnyCPU C# platform=AnyCPU
+----------------+ References +------------------------+
| MyApp +---------------------> CLibraryWrapper |
| | | |
| MyApp.sln | | CLibraryWrapper.sln |
| MyApp.csproj | | CLibraryWrapper.csproj |
| | | |
+----------------+ +-------+----------------+
|
| Depends
|
v
C Shared Library
+------------------+
| CLibrary |
| |
| CLibrary.sln |
| CLibrary.vcxproj |
| |
+------------------+
Question #1
I should be able to build CLibraryWrapper for AnyCPU
platform and that requires setting up CLibraryWrapper project
in a such way that it would build CLibrary for x86
and x64
platforms. I'm loading CLibrary.dll
at run-time depending on the process platform so I need both (x86 and x64) binaries to be present.
End result after CLibraryWrapper AnyCPU
build should look like this:
|_bin/Debug/
|_CLibraryWrapper.dll
|_x86/
|_CLibrary.dll
|_x64/
|_CLibrary.dll
Is there a way to achieve this in Visual Studio build configuration?
Question #2
MyApp should be able to add CLibraryWrapper as a project reference.
End result should be that MyApp builds CLibraryWrapper which in turn builds x86/CLibrary.dll
and x64/CLibrary.dll
.
This way MyApp would be built with all it's dependencies from source code.
I've read that you can't reference solution
from another solution
. And solution controls build dependencies. I would really like MyApp to reference CLibraryWrapper and inherit CLibrary
build configuration.
I was not able to find out how to setup my Visual Studio build configuration this way.