- 安装了Visual Studio 2022(在干净/新鲜的Windows 11安装),安装了Template Studio for WinUI (v5.3)。
- 使用模板工作室创建一个项目,设置如下:
- Project type: Navigation pane
- Design pattern: MVVM Toolkit
- Pages (Blank pages):
* Page1
* Page2
*
*
* Settings page
- Features:
* Settings Storage added
* MSIX Packaging added
* Self-Contained added
* App Notifications added
* Theme Selection added
- Testing: MSTest not added
安装Microsoft.EntityFrameworkCore.SqlServer(连接到我的SQL Server).
安装Microsoft.EntityFrameworkCore.SqlServer(最新稳定7.0.4)后,立即尝试运行应用程序,我得到以下错误:
Found multiple publish output files with the same relative path:
D: 7_PROJECTSKratos365Kratos365objx64Debugnet7.0-windows10.0.19041.0win10-x64MsixContentMicrosoft.Web.WebView2.Core.dll,
C:Usersmladen.nugetpackagesmicrosoft.web.webview21.0.864.35libnetcoreapp3.0Microsoft.Web.WebView2.Core.dll
Kratos365 C:Program Filesdotnetsdk7.0.202SdksMicrosoft.NET.SdktargetsMicrosoft.NET.ConflictResolution.targets 112
我确实注意到,同时安装Microsoft.EntityFrameworkCore.SqlServer, Microsoft.Web。WebView2(版本1.0.864.35)安装完毕,如下截图所示:
截图但是我猜(从错误中)有另一个版本的Microsoft.Web。WebView2 in MSIX Packaging in Project文件夹
What I tried:
- 我尝试将以下属性添加到我的.csproj文件中,正如这里的答案所建议的
<PropertyGroup>
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
</PropertyGroup>
但这给了我以下错误:
Payload contains two or more files with the same destination path 'Microsoft.Web.WebView2.Core.dll'. Source files:
D: 7_PROJECTSKratos365Kratos365objx64Debugnet7.0-windows10.0.19041.0win10-x64MsixContentMicrosoft.Web.WebView2.Core.dll
C:Usersmladen.nugetpackagesmicrosoft.web.webview21.0.864.35libnetcoreapp3.0Microsoft.Web.WebView2.Core.dll
Kratos365 C:Usersmladen.nugetpackagesmicrosoft.windowsappsdk1.2.230313.1buildTransitiveMicrosoft.Build.Msix.Packaging.targets 1504
我尝试从项目文件夹中删除'bin'和'obj'文件夹并重建解决方案,但这给了我一堆其他错误。
我尝试卸载(开始菜单>右键单击它,卸载),然后在尝试再次部署它之前在Visual Studio中清理解决方案,如这里的答案所建议的
在这一点上,我尝试了所有我能在网上找到的东西-在这里发布一个问题是我最后的手段
这可能是一些奇怪的模板工作室WinUI/Microsoft.EntityFrameworkCore.SqlServer冲突?
最后解决方案是降级Microsoft.EntityFrameworkCore.SqlServer NuGet包从最新稳定版7.0.4降至6.0.15.
6.0.15 (7.0.0;7.0.1;7.0.2;7.0.3;7.0.4),包含Microsoft.Web。WebView2会吐出错误找到多个具有相同相对路径的发布输出文件
我想是某种微软网站。WinUI和Microsoft.EntityFrameworkCore.SqlServer NuGet包的WebView2版本冲突