Flutter 引入webview_windows插件,在已经使用$PATH 中的 nuget.exe情况下,windows端构建失败

报错

PS F:\xx\xxxx> flutter run -d windows      
Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
Launching lib\main.dart on Windows in debug mode...
E:\Some software\Visual Studio\VS 2022\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,5): error MSB3073: ���setlocal [F:\xx\xxxx\build\windows\x64\plugins\webview_windows\webview_windows_DEPENDENCIES_DOWNLOAD.vcxproj]
E:\Some software\Visual Studio\VS 2022\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,5): error MSB3073: C:\Windows\System32\nuget.exe install Microsoft.Windows.ImplementationLibrary -Version 1.0.220914.1 -ExcludeVersion -OutputDirectory F:/xx/xxxx/build/windows/x64/packages [F:\xx\xxxx\build\windows\x64\plugins\webview_windows\webview_windows_DEPENDENCIES_DOWNLOAD.vcxproj] 
E:\Some software\Visual Studio\VS 2022\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd [F:\xx\xxxx\build\windows\x64\plugins\webview_windows\webview_windows_DEPENDENCIES_DOWNLOAD.vcxproj]
E:\Some software\Visual Studio\VS 2022\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,5): error MSB3073: C:\Windows\System32\nuget.exe install Microsoft.Web.WebView2 -Version 1.0.1210.39 -ExcludeVersion -OutputDirectory F:/xx/xxxx/build/windows/x64/packages [F:\xx\xxxx\build\windows\x64\plugins\webview_windows\webview_windows_DEPENDENCIES_DOWNLOAD.vcxproj]
E:\Some software\Visual Studio\VS 2022\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd [F:\xx\xxxx\build\windows\x64\plugins\webview_windows\webview_windows_DEPENDENCIES_DOWNLOAD.vcxproj]
E:\Some software\Visual Studio\VS 2022\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,5): error MSB3073: :cmEnd [F:\xx\xxxx\build\windows\x64\plugins\webview_windows\webview_windows_DEPENDENCIES_DOWNLOAD.vcxproj]
E:\Some software\Visual Studio\VS 2022\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone [F:\xx\xxxx\build\windows\x64\plugins\webview_windows\webview_windows_DEPENDENCIES_DOWNLOAD.vcxproj]
E:\Some software\Visual Studio\VS 2022\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,5): error MSB3073: :cmErrorLevel [F:\xx\xxxx\build\windows\x64\plugins\webview_windows\webview_windows_DEPENDENCIES_DOWNLOAD.vcxproj]
E:\Some software\Visual Studio\VS 2022\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,5): error MSB3073: exit /b %1 [F:\xx\xxxx\build\windows\x64\plugins\webview_windows\webview_windows_DEPENDENCIES_DOWNLOAD.vcxproj]
E:\Some software\Visual Studio\VS 2022\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,5): error MSB3073: :cmDone [F:\xx\xxxx\build\windows\x64\plugins\webview_windows\webview_windows_DEPENDENCIES_DOWNLOAD.vcxproj]
E:\Some software\Visual Studio\VS 2022\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd [F:\xx\xxxx\build\windows\x64\plugins\webview_windows\webview_windows_DEPENDENCIES_DOWNLOAD.vcxproj]
E:\Some software\Visual Studio\VS 2022\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,5): error MSB3073: :VCEnd�����˳�������Ϊ 1�� [F:\xx\xxxx\build\windows\x64\plugins\webview_windows\webview_windows_DEPENDENCIES_DOWNLOAD.vcxproj]

解决方法

在 Windows 上运行 Flutter 应用时遇到了 MSB3073 错误。这个错误通常与 NuGet 包的安装问题有关

错误信息表明 NuGet 无法成功安装所需的包,导致构建失败

1、使用vs打开项目
2、点击 工具 -> NuGet 包管理器 -> 程序包管理器设置
在这里插入图片描述
3、在常规中,将以下选项设置成图中所示
在这里插入图片描述
4、添加程序包源
https://www.nuget.org/api/v2/
名字可以随便取
在这里插入图片描述
5、点击确定,关闭vs

6、重新打开vs,工具 -> NuGet 包管理器 -> 程序包管理器设置 ,清除存储
在这里插入图片描述
7、删除图中框出的两项
在这里插入图片描述
8、运行命令

flutter pub get --no-example

flutter run -d windows

完结,撒花~

相关推荐

最近更新

  1. TCP协议是安全的吗?

    2024-05-10 07:10:06       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-05-10 07:10:06       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-05-10 07:10:06       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-05-10 07:10:06       20 阅读

热门阅读

  1. github 大项目断点续传

    2024-05-10 07:10:06       10 阅读
  2. android 手机和平板如何适配

    2024-05-10 07:10:06       11 阅读
  3. Github 学习使用随手记

    2024-05-10 07:10:06       10 阅读
  4. 【Web漏洞指南】DOM XSS

    2024-05-10 07:10:06       8 阅读
  5. 基于STM32的宠物箱温度湿度监控系统毕业设计

    2024-05-10 07:10:06       12 阅读
  6. WEB基础--数据库事务与连接池

    2024-05-10 07:10:06       9 阅读
  7. day07-缓存套餐

    2024-05-10 07:10:06       10 阅读
  8. C++ QT设计模式:状态模式

    2024-05-10 07:10:06       9 阅读