Xamarin.Forms 升级到 Maui – Visual Studio 无法进行调试/运行?

huangapple go评论74阅读模式
英文:

Xamarin.Forms upgraded to Maui - Visual Studio Cannot debug/run?

问题

使用Microsoft的自动升级命令行工具升级了应用程序。

进行了一些代码修复,代码现在成功构建。

但是Visual Studio没有显示任何调试应用程序的选项。

尝试点击"Debug"时,会打开我的设备列表中的一个随机Android模拟器(该列表当前未显示),但部署会失败,没有指定失败的原因。

有人成功将现有的Xamarin.Forms项目升级为Maui吗?

英文:

Application upgraded using Microsoft's auto upgrade command line tool.

Some code fixes, and the code builds successfully.

Visual Studio however does not show me any way to debug my app.

When trying to click on Debug anyway, a random Android Emulator from my list(which is not showing currently)

Will open, but deployment will fail without specifying the reason.

Has anyone managed to upgrade an existing Xamarin.Forms project to Maui?

答案1

得分: 3

我成功让VS识别我的转换后解决方案中的Android项目。

我在我的Android项目的.csproj文件的第一个/主属性组下添加了<SingleProject>true</SingleProject>属性,关闭了VS,删除了Bin、Obj和.vs文件夹。

再次启动VS后,我重新构建,并且VS允许我在选择的.NET目标上进行调试,就像在单个项目的Maui解决方案中一样。

这非常奇怪,因为这个解决方案由3个项目组成,就像Xamarin.Forms解决方案一样,所以添加这个属性解决了问题,但是问题就是这样。

英文:

I managed to make VS recognize the Android project in my converted solution.

I added the <SingleProject>true</SingleProject> property into my Android project's .csproj file under the first/main property group, closed VS, deleted Bin, Obj, .vs folders.

After starting VS again , I rebuilt and VS allowed me to debug on selected .net targets like a single project Maui solution.

This is very strange that it works, since this solution is made of 3 project like in a Xamarin.Forms solution, so it doesn't make since that adding this property solves the issue, but there you go.

答案2

得分: 0

  1. 删除 .bin.obj 文件夹。删除解决方案的隐藏 .vs 文件夹。构建。现在是否显示调试选项?
  2. 尝试重新启动 VS(在成功构建后)。现在可以工作了吗?
  3. 如果不行,使用 Maui 模板创建一个新项目。
  4. 使用解决方案/管理所有 NuGet 来添加项目中使用的 NuGet 包。
  5. 将所有源文件复制到新项目中。
  6. 项目/“添加现有项”:所有这些源文件。
英文:
  1. Delete .bin and .obj folders. Delete solution's hidden .vs folder. Build. Does it show debug option now?
  2. Try restarting VS (after the successful build). Now work?
  3. If not, Create a new project using Maui template.
  4. Use solution / manage all nugets to add nugets used by your project.
  5. Copy all your source files into that new project.
  6. Project / "Add existing items": all those source files.

huangapple
  • 本文由 发表于 2023年2月16日 19:42:49
  • 转载请务必保留本文链接:https://go.coder-hub.com/75471762.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定