VS2022远程调试Ubuntu CMake项目遇Rsync指定方法不支持错误
解决VS2022通过SSH连接Ubuntu构建CMake项目时的Rsync不支持错误
我正在开发基于CMake的项目,使用VS2022社区版的Connection Manager通过SSH连接Ubuntu虚拟机,连接已成功,但构建项目时出现**Rsync error. Specified method is not supported.**错误。已更新本地rsync版本,但问题仍未解决,错误日志如下:
1> [CMake] -- Generating done (0.1s) 1> [CMake] -- Build files have been written to: /home/... 1> Extracted CMake variables. 1> Extracted source files and headers. 1> Extracted code model. 1> Extracted toolchain configurations. 1> Extracted includes paths. 1> Specified method is not supported. Specified method is not supported. at liblinux.IO.Rsync.PrepareForDirectorySync(Int32 sessionID, IReadOnlyCollection`1 paths, RsyncDirection direction, RemoteRsyncDaemon daemon, String[] daemonOptions, Int32 localPort, RsyncVerbosity verbosity, Boolean recursive, IReadOnlyCollection`1 includes, IReadOnlyCollection`1 excludes, String customOptions) at liblinux.IO.Rsync.<SyncDirectoriesAsync>d__23.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at liblinux.IO.Rsync.<SyncDirectoriesAsync>d__23.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.CMake.Linux.Project.CMakeLinuxHeadersUpdateTask.<>c__DisplayClass9_0.<<UpdateHeaders>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Threading.JoinableTask.CompleteOnCurrentThread() at Microsoft.VisualStudio.CMake.Linux.Project.CMakeLinuxHeadersUpdateTask.UpdateHeaders(CMakeConfiguration config, IBuildProject project, String[] projectIncludes, String[] projectExcludes, String[] projectDownloads, Boolean force) at Microsoft.VisualStudio.CMake.Linux.Project.RemoteCMakeParser.<AfterParseAsync>d__33.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.CMake.Linux.Project.RemoteCMakeParser.<ParseAsync>d__29.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.CMake.Project.ExternalBuildProject.ProjectProvider.<ParseProjectAsync>d__46.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.VisualStudio.CMake.Project.ExternalBuildProject.ProjectProvider.<ParseProjectAsync>d__46.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Workspace.ExternalBuildFramework.Impl.ParseCache.<ParseAsyncImpl>d__34.MoveNext()
修复方案与排查方向
- 检查Ubuntu端rsync版本与配置
- 确保Ubuntu虚拟机上安装了rsync,版本不低于3.1.0,执行
rsync --version查看当前版本 - 无需额外启动rsync daemon,VS通过SSH直接调用rsync,确认远程用户可正常执行rsync命令
- 确保Ubuntu虚拟机上安装了rsync,版本不低于3.1.0,执行
- 调整VS2022文件同步设置
- 打开工具->选项->跨平台->连接管理器,选中目标Ubuntu连接,点击修改
- 在高级选项卡中,将文件同步方式设置为Rsync (SSH),避免选择SCP等不兼容模式
- 若配置了自定义rsync参数,暂时清空参数后测试,排除参数不兼容问题
- 验证SSH连接权限与环境
- 确认SSH用户对远程项目目录有读写权限,执行
ls -ld /home/你的项目路径检查权限设置 - 执行
ssh 用户名@ubuntu服务器地址 which rsync,确认rsync在远程用户的PATH环境变量中
- 确认SSH用户对远程项目目录有读写权限,执行
- 重置VS项目缓存与配置
- 删除本地项目的
.vs目录和CMake构建缓存文件夹(如out/build) - 重新触发CMake配置:点击CMake->删除缓存并重新配置
- 删除本地项目的
- 更新VS2022跨平台组件
- 打开VS Installer,检查**Linux开发用的C++**组件是否为最新版本,更新组件以修复工具链兼容性问题
内容的提问来源于stack exchange,提问作者Kiyen11
相关产品推荐
相关产品推荐

