Service Fabric:未找到 pkg\Debug

问题描述

我已经创建了 Service Fabric 应用程序并将无状态 ASP.NET Core Web API 3.1 项目添加到其中。当我使用 VS 2019 在本地运行 Service Fabric 应用程序时,出现以下错误:-

The PowerShell script Failed to execute. See the Service Fabric Tools pane in the output window for details.

下面是输出窗口信息

C:\Users\malle\Documents\Mahesh\Projects\RetentionPortal\API\Application1\pkg\Debug is not found.
At C:\Program Files\Microsoft SDKs\Service 
Fabric\Tools\PSModule\ServiceFabricSDK\Publish-NewServiceFabricApplication.ps1:120 char:9
+         throw $errMsg
+         ~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (C:\Users\malle\...g is not found.:String) [],RuntimeException
    + FullyQualifiedErrorId : C:\Users\malle\Documents\Mahesh\Projects\RetentionPortal\API\Application1\pkg\Debug is n 
   ot found.
 
Finished executing script 'Publish-NewServiceFabricApplication'.
Time elapsed: 00:00:01.7629461
Started executing script 'Unpublish-ServiceFabricApplication'.
powershell -NonInteractive -noprofile -WindowStyle Hidden -ExecutionPolicy Bypass -Command "[void](Connect-ServiceFabriccluster); Import-Module 'C:\Program Files\Microsoft SDKs\Service Fabric\Tools\PSModule\ServiceFabricSDK\ServiceFabricSDK.psm1'; Unpublish-ServiceFabricApplication -ApplicationName 'fabric:/Application1' -ErrorAction Stop"
Removing application...
Finished executing script 'Unpublish-ServiceFabricApplication'.
Time elapsed: 00:00:01.5278716
Started executing script 'UnregisterapplicationType'.
powershell -NonInteractive -noprofile -WindowStyle Hidden -ExecutionPolicy Bypass -Command "[void](Connect-ServiceFabriccluster); Import-Module 'C:\Program Files\Microsoft SDKs\Service Fabric\Tools\PSModule\ServiceFabricSDK\ServiceFabricSDK.psm1'; if (Get-ServiceFabricApplicationType -ApplicationTypeName 'Application1Type' | Where-Object { $_.ApplicationTypeVersion -eq '1.0.0' }) { Unregister-ServiceFabricApplicationType -ApplicationTypeName 'Application1Type' -ApplicationTypeVersion '1.0.0' -ErrorAction Stop -Force }"
Finished executing script 'UnregisterapplicationType'.
Time elapsed: 00:00:01.4425472

非常感谢任何帮助

解决方法

一般解决步骤:

  1. 重启电脑
  2. 登录
  3. 以管理员身份启动 Visual Studio
  4. 开放 Service Fabric 项目
  5. F5 调试
  6. 尝试再次运行同一个项目,同样的输出
  7. 以管理员身份运行 POwerShell, Connect-ServiceFabricCluster

enter image description here

  1. 在 Visual Studio 中开始调试 (F5)
  2. 现在一切都很好

更多详情,可以在github上查看issues。

Publish-NewServiceFabricApplication fails to read ApplicationManifest.xml

如果上述解决方案不起作用,建议尝试以下步骤。

  1. 创建 pkg/Debug 文件夹。

enter image description here

  1. 我在 Debug 文件夹下有一些文件,所以我删除了它们。

enter image description here

  1. 清理和重建解决方案。

enter image description here

  1. F5 运行。它将生成您想要的文件。

enter image description here

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...