如何在Visual Studio上设置Linux上的远程构建? [英] How to setup Remote building on Linux from Visual Studio?

查看:57
本文介绍了如何在Visual Studio上设置Linux上的远程构建?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


目前,我正在尝试使用Visual Studio加载代码以获得更好的代码导航并使用visual studio中的其他工具。我们的构建服务器是CentOS(x64)服务器,因此当我们需要构建代码时,我们只需将Teraterm或mintty用于
ssh到服务器并运行我们的代码库中可用的构建脚本。


现在,我已经设法使用genvcxproj.sh脚本为visual studio生成一个linux项目。现在我已经加载了项目,这是我遇到问题的构建部分。


我正在尝试设置远程构建,我可以在其中运行相同的脚本构建服务器和命令的输出将显示在"输出"窗口中。  以下是我所做的:


1。)通过连接管理器,我连接到我们的构建服务器的端口22。


2。)在在项目属性页面中,我输入了在服务器中调用必要的构建脚本所需的命令。 


它看起来像这样:


cd / data1 / p4work / MyView


./ build_sim.sh


3。现在,当我按下工具栏中的构建按钮时,就会出现这种情况。


1>远程将源复制到<服务器名称>


1>调用cd < build directory>


1> source .SetEnv


1> ./ build_sim.sh


1> bash:line 1:cd:  < build directory> ;


1>:没有这样的文件或目录


所以,我的问题是:这是通过目标linux上的ssh运行的吗机?或者这是从Windows(我的计算机的操作系统)本身运行的吗?


有没有办法在目标机器上运行构建脚本,就像我通过teraterm或其他终端所做的那样?



提前致谢!


解决方案


欢迎来到MSDN论坛。


通常,您无法在目标计算机上构建,您将在主机上构建,然后在目标计算机上加载和调试。


类似的问题已在
here
中讨论过,AliAskari的回复:


这与问题
#87
非常相似。我最终做了什么:


  1. 编写了一个后期构建脚本,它将构建的二进制文件从构建环境(docker container / VM)复制到调试环境。
  2. 在Visual Studio中创建了两个单独的配置,即远程调试
    远程构建。在远程构建的设置中,我有关于我的构建远程(主机名,用户名,密码,构建脚本以及后构建脚本)的信息,并且在远程调试中我只有关于调试机器的信息
    (主机名,用户名,密码,程序路径)。

这解决了我的所有问题。每当我想构建时,我选择
远程构建
配置,当我想调试时,我选择远程调试,它运行得非常好。唯一的问题是visual studio不知道二进制文件的最新状态,并且总是告诉我二进制文件是我们的
日期/构建不成功。


最好问候,


Joyce



Hi,

Currently, I'm trying to use Visual Studio to load our codes for better code navigation and to make use of other tools found in visual studio. Our build server is a CentOS(x64) server so when we needed to build the codes, we just use Teraterm or mintty to ssh into the server and run the build scripts available in our codebase.

Right now, I have managed to use the genvcxproj.sh script to generate a linux project for visual studio. Now that I have loaded the project, it is the build part that I am having a problem in.

I am trying to setup a remote build where I could just run the same scripts in the build server and the output of the commands will be displayed in the Output window.  Here's what I have done:

1.) Via Connection Manager, I connected to our build server's port 22.

2.) In the project property page, I entered the commands needed to call the necessary build script in the server. 

It looks something like this:

cd /data1/p4work/MyView

./build_sim.sh

3. Now when I press the build button from the toolbar,  this comes out.

1>Copying sources remotely to <server name>

1>Invoking cd <build directory>

1> source .SetEnv

1>./build_sim.sh

1>bash: line 1: cd: <build directory>

1>: No such file or directory

So, my question is: is this running via ssh on the target linux machine? or is this running from windows(my computer's OS) itself?

Is there a way to run the build scripts on the target machine just like what i'd do via teraterm or some other terminal?

Thanks in advance!

解决方案

Hi,

Welcome to MSDN forum.

Normally, you cannot build on the target machine and you will build on a host machine and then load and debug on the target machine.

The similar issue has been talked about in here, a reply from AliAskari:

This is very similar to issue #87. What I have ended up doing:

  1. Wrote a post build script that copies the built binary from the build environment (docker container/VM) to the debug environment.
  2. Created two separate configurations in Visual Studio, namely Remote Debug and Remote Build. In the settings for Remote Build I have the information about my build remote (hostname, username, password, build script, and also the post build script), and in the Remote Debug I only have the information about the debug machine (hostname, username, password, path to program).

This has solved all of my problems. Whenever I want to build I select the Remote Build configuration and when I want to debug I select Remote Debug and it has worked quite good. The only problem is that visual studio doesn't know the latest state of the binary and always tells me that the binary is our of date/build was not successful.

Best regards,

Joyce


这篇关于如何在Visual Studio上设置Linux上的远程构建?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆