Search code examples
c++visual-studiomsbuildvisual-studio-2022vcpkg

Compile existing MSBuild project for Linux


I have an existing MSBuild project. I want to compile that for Linux ARM 64. I'm using vcpkg package manager becuase CMake is too difficult to maintain.

The lanuage i'm writing in is C++.

I'm using Visual Studio Community 2022. My question is: How can I compile an existing MSBuild project for Linux, inside Windows by using Visual Studio Community 2022 or other?


Solution

  • For C++ cross-platform development, you can use the WSL(Windows Subsystem for Linux).

    Windows Subsystem for Linux (WSL) lets developers run a GNU/Linux environment -- including most command-line tools, utilities, and applications -- directly on Windows, unmodified, without the overhead of a traditional virtual machine or dual-boot setup.

    Four steps for setting up a WSL development environment:

    In order to compile your c++ code on WSL/Linux, you need to install the libraries you depend on firstly on WSL/Linux. You can also use vcpkg on WSL to manage your c++ packages, but you should install the vcpkg on WSL/Linux firstly, not the vcpkg on Windows that you used now. So you can install vcpkg on WSL/Linux firstly, then use the vcpkg to install libraries you depend on. In order to let CMake to find the libraries from vcpkg, refer to CMake Integration.

    And you must learn to use CMake to organize your project. Here is a step-by-step guide for using CMake.