求助:使用Uno Platform VS Code扩展时遇setLSActiveProject启动服务器失败错误
解决Uno Platform VS Code扩展Enable时启动服务器失败的问题
问题场景
我正在开发名为Conference Live Captioning的MAUI安卓应用,使用Uno Platform VS Code扩展时,点击扩展菜单的「Enable」按钮触发以下错误:
[Info] Using 'ms-dotnettools.csharp' version 2.0.399. [Info] Requesting available projects from OmniSharp [Info] Setting active project /Users.../BeAware/BeAware.csproj [Error] setLSActiveProject failed: Error: Starting server failed Uno Platform "dotnet new" templates are already installed. The templates may be updated by running "dotnet new install Uno.Templates"
已确认VS Code打开了包含解决方案文件(SLN)的目录,且谷歌搜索未找到相关解决方法,寻求帮助。
解决方案
清理OmniSharp缓存
打开VS Code命令面板(Ctrl+Shift+P / Cmd+Shift+P),执行OmniSharp: Restart OmniSharp;若无效,手动删除OmniSharp缓存目录:- macOS:
~/.omnisharp - Windows:
%USERPROFILE%\.omnisharp
重启VS Code后再次尝试启用扩展。
- macOS:
更新相关组件
- 在终端执行
dotnet new update,更新所有已安装的dotnet模板(包括Uno模板)。 - 在VS Code扩展市场找到「C# Dev Kit」(原ms-dotnettools.csharp),更新到最新版本后重启VS Code。
- 在终端执行
验证项目兼容性
进入项目目录,执行dotnet restore确保所有依赖正常加载;检查项目文件(.csproj)中的Uno相关SDK引用,确认版本与当前Uno Platform扩展兼容。重置Uno Platform扩展状态
- 在VS Code中禁用并卸载Uno Platform扩展。
- 关闭VS Code,删除对应扩展缓存文件夹:
- macOS:
~/.vscode/extensions下的unoplatform.vscode相关文件夹 - Windows:
%USERPROFILE%\.vscode\extensions下的对应文件夹
- macOS:
- 重新安装Uno Platform扩展,重启VS Code后尝试启用。
检查dotnet环境
执行dotnet --version确认使用的dotnet SDK版本符合Uno Platform官方推荐的LTS版本要求,若版本过低,升级到兼容的最新SDK版本。
内容的提问来源于stack exchange,提问作者Saamer
相关产品推荐
相关产品推荐

