Visual Studio 2017 项目无法在 Mac 上的 Parallels Desktop 中 run/debug?

Visual Studio 2017 project can't run/debug in Parallels Desktop on Mac?

我真的需要你的帮助。我刚开始学习 C#。我遵循了 Head First C# 的每个步骤。书上Visual Studio版本是2012,它告诉我创建的项目类型是Blank App (XAML) Visual C#,我的Visual Studio2017找不到, 所以我选择下面描述的类型。

关于我的computer/system:

软件:微软 Visual Studio 2017.

项目类型为:Blank App (Universal Windows) Visual C#。

计算机:在 Mac OSX.

上使用 Parallels Desktop 到 运行 Windows10

Parallels Desktop,这是一个虚拟机软件,用于 运行ning Windows 10 在我的 Mac 上。我在这个虚拟机上创建了我的项目,在我按照书中的步骤完成项目后,编辑器没有错误。但是在我按下绿色播放按钮后,出现了一些错误,我在下面发布了这个错误。

您确定选择了绿色按钮旁边的“Debug”模式而不是“Release”吗? 可能您正在尝试以 Visual studio - Debug 模式而不是 运行 部署应用程序..

  1. 检查您的项目是否存储在 Parallels Desktop 的 Windows10 运行 的 C:\ 驱动器中。

  2. 如果找不到存储项目的位置:

    1. 回到你的 Mac OSX > Finder > iCloud Drive > Documents > Visual Studio 2017 > Projects > 检查你的项目是否存储在这里,如果是,我会解决你的问题。
    2. 如果你的项目已经存在于Parallels Desktop的Windows10的C:\下,请搜索其他解决方案,我无法解决你的问题,抱歉。
  3. You stored your project in the wrong place.

  4. Don't copy and paste your project directly to Windows10 in the Parallels Desktop.

  5. 重新创建项目。是的,重新创建它...但是这一次,请确保您的项目存储在 Parallels Desktop 中的 C:\(我的意思是您的项目的位置以 C:\ 开头)。


解释图片中的错误信息:

首先我想说,我是Visual Studio2017的新手,不知道为什么Output里显示的语言是中文,我已经在环境里改成英文了设置。抱歉,如果你看不懂中文。

但是它的英文意思是:

Windows can't deploy/debug your project because your project is stored in the file system of type PrlSF.

由于我项目的默认路径是:

In Windows on Parallels Desktop > iCloud on 'Mac'(X:) > Documents > Visual Studio 2017 > ...

如果你右击'Mac'(X:)上的iCloud,你会发现它的类型是PrlSF.是的,如错误消息所示,您将项目存储在错误的位置。

我遇到了同样的问题,在Parallels论坛找到了以下解决方案: https://forum.parallels.com/threads/prlsf-permissions-issue-when-developing-an-uwp-app-in-visual-studio.342549/

所以归功于论坛中的用户 JakubZ:

For further reference, the steps to resolve this issue are as follows:

  1. Unload the UWP project (R-click on project and then select "Unload Project"
  2. Edit the project file in VS (R-click on unloaded project and then select "Edit ...")
  3. Find an XML entry for the OutputPath. For instance the entry for OutputPath when building for Debug|x86 should look like bin/x86/Debug. Notice that the entry contains relative path.
  4. Edit the path to an absolute path on one of VMs drives. For instance, to set the path to the %TEMP%\UWPBuilds\x86\Debug directory for the user write $(TEMP)\Debug
  5. Close the project file
  6. Reload the project (R-click on unloaded project and then select "Reload Project").

作为补充:因为我有多个 运行 配置,所以我也有多个 OutputPath 条目。我不得不相应地更改所有这些。