问题描述
我已经创建了 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
非常感谢任何帮助
解决方法
一般解决步骤:
- 重启电脑
- 登录
- 以管理员身份启动 Visual Studio
- 开放 Service Fabric 项目
- F5 调试
- 尝试再次运行同一个项目,同样的输出
- 以管理员身份运行 POwerShell,
Connect-ServiceFabricCluster
。
- 在 Visual Studio 中开始调试 (F5)
- 现在一切都很好
更多详情,可以在github上查看issues。
Publish-NewServiceFabricApplication fails to read ApplicationManifest.xml
如果上述解决方案不起作用,建议尝试以下步骤。
- 创建
pkg/Debug
文件夹。
- 我在 Debug 文件夹下有一些文件,所以我删除了它们。
- 清理和重建解决方案。
- F5 运行。它将生成您想要的文件。