How to write native C++ in VS 2022, using Linux for build and test - c++

I need a native C++ app to make from scratch. It has to run on linux (CentOS). I want to use VS2022 to write and test. I have Hyper-V VM with CentOS.
I tried to google a solution but there are only posts for using WSL.
Can someone please describe steps to connect VS to Linux VM instead of WSL so I can build and run the app on the VM.

This article describes the process: https://devblogs.microsoft.com/cppblog/linux-development-with-c-in-visual-studio/
add workload to the VS using VS Installer (Linux and embedded..)
create project of correct type
add SSH credentials in the project Properties (also can be added/removed/edited in Tools-Options-Cross Platform)

Related

Dockerize a Visual Studio C++ project on Windows home

I am new to Docker, using windows 10 home edition, and want to create a docker image for my C++ project developed with visual studio. As far as I understand, the image I need to create is going to be a windows image, and therefore I need to install “Docker for windows” and enable the Hyper-V feature. This is not possible with my windows home edition, as Hyper-V is available for windows 10 pro only. The other alternative, using “Docker toolbox” and a virtualbox linux VM, does not support creating or pulling windows containers. Did I miss something? Is there a workaround?
You could use the Windows Linux Subsystem: https://medium.com/#sebagomez/installing-the-docker-client-on-ubuntus-windows-subsystem-for-linux-612b392a44c4
EDIT: On second read of your question you probably want to have a windows-container for visual studio. This solutions makes Linux-containers possible, but doesn't help with windows images...
As you know, you are unable to install Docker for Windows Home edition, as it requires Hyper V virtualization.
So these are your options:
You will need to install Docker Toolbox which uses VirtualBox instead.
Docs and setup info available here:
https://docs.docker.com/toolbox/toolbox_install_windows/
Release downloads available here:
https://github.com/docker/toolbox/releases
Toolbox will install everything you need including VirtualBox.
You may also need to enable virtualization in your computer's BIOS settings. This will be different for each manufacturer, please refer to their documentation on which keys to use to access these settings on reboot.
After Toolbox is finished installing, open the Docker Quickstart Terminal. This will complete the setup and provision your VirtualBox machine.
Check your install:
Launch the Docker QuickStart terminal and type the command:
docker run hello-world
This should pull down the test container and print hello-world to your screen.

How to build Qt applications using Team Foundation Server 2017

I am currently in the process of migrating a couple of legacy Qt5 projects to a new Team Foundation Server. All projects have been developed for Windows in Visual Studio using the Qt VS AddIn (and thus don't use .pro-files). I would love to use the TFS Build Agent to build these on other platforms (mainly linux).
I have previously done this on other projects using Jenkins and qmake, having platform-dependent settings in the .pro-file.
Is there an established workflow for building VS projects using Qt5 via a TFS Build Server on other platforms?
I don't use TFS but, since TFS Build operates on Visual Studio solutions, it ought to be possible to use the "Linux development with C++" feature of VS2017. Just setup a Linux project in the VS solution and it should build like any other.
Seems you'd like to build Cross-Platform Code in Linux using TFS vNext build system. To build or deploy you'll need at least one agent. The cross platform build agent is support on Ubuntu, Red Hat, and CentOS.
Detail steps please refer this tutorial-- Deploy an agent on Linux. Then simply create the build definition add build task, select the Linux build agent the same as build on windows. More detail step and build configuration you could take a look at this video tutorial-- Building and Deploy Applications In Linux With TFS
In your case, there is not corresponding VS/Qt VS AddIn in your Linux environment. You need to set up your Linux build agent local environment to build your qt5 application successfully, then it's not hard to build through tfs.
Another way is scripting the Linux build process to run over SSH or some other remote protocol, and driving this process from the Windows build agent.

Managed builds on Linux

We have a TFS server which runs builds of our Windows-based software.
Now we had to port part of our software to Linux and we want to run the builds in a similar manner on Linux.
The project on Linux is created using Eclipse CDT, written in C++. The question would be how to run builds of this project on a Linux machine, and will it be possible to somehow integrate it into TFS infrastructure? For quality control, etc.
There is no out-of-the-box solution: currently there are no agents for Linux.
But wait, I did this once for a customer. The solution's pieces were:
setup SSH on Linux
write a Linux build script and save it in TFS version control
modify the custom template using the Community Build Extensions to:
a. push the script
b. invoke the script remotely
c. collect the build log(s)
d. copy the logs to the OutDir
I wrote a blog post with detailed instruction: http://casavian.eu/wordpress/2014/02/13/integrating-linux-builds-in-tfs/.

How Remote Development of C++ works in Netbeans?

Hi we want to use remote development features of netbeans but while trying out on our setup its very slow. I want to understand its feasibility of integrating our build environment with netbeans.
Our setup would be normally:
1. Windows 7 Professional 64bit where we install netbeans
2. RHEL 5.5 64bit linux where we have tools and sources
Normally we directly connect to that machine through PuTTY and use VIM to edit sources and gmake to compile and build projects. Now when I created the "New Remote Project with existing sources" and try to use it It took more time to load the project.
So Can anybody tell me how actually this remote compilation works??
Because we have some GBs of sources here on linux box and I want to know is it possible for smooth development with this big data??
Simple steps. Read this tutorial. You just need a SSH-server on your Linux.
The process is easy, your Netbeans connects to the SSH-server and searches for compilation tools then uses them to build your projects.
The second issue is creating a shared folder that your Windows and Linux able to access to it. I suggest you first create a shared folder on your Windows and use Samba client on your Linux.

Can I build and debug c++ programs on remote machine?

I am on windows XP want to build the programs on linux remote pc
i have eclipse Ganymede, CDT, RSE installed on remote machine... but how to configure all this?
am I doing correct? could anybody suggest
You could access your remote machine using VNC or similar remote desktop infrastructures. That would allow you to work with Eclipse (edit, build, run, debug, etc) as you would in your local machine.
If bandwidth is too narrow or you don't manage the Linux box, you could access via SSH or telnet and work in console mode (with Emacs/Vim, gdb and all that stuff).
Take a look at https://github.com/ericwoodruff/rmake you would configure your IDE and edit code locally but it uses rsync to build on the remote machine. I've used it at HP to build C++ programs across multiple platforms, linux->windows, windows->linux. It works in the command line and I've used an eclipse builder to invoke it as well. If you enable --no-decorate Eclipse can even parse the build output into the problems view.