Search code examples
azureazure-web-app-serviceazure-service-fabricservice-fabric-stateless

Service Fabric: pkg\Debug is not found


I have created Service Fabric Application and added Stateless ASP.NET Core Web API 3.1 project into it. When I run the Service Fabric Application locally using VS 2019, I am getting the below error:-

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

Bellow is the output window info

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

Any help is really appreciated


Solution

  • General solution steps:

    1. Reboot Computer
    2. Log On
    3. Start Visual Studio as Admin
    4. Open Service Fabric Project
    5. F5 to Debug
    6. Try to run the same project again, same output
    7. Run POwerShell as Admin, Connect-ServiceFabricCluster.

    enter image description here

    1. Start debugging (F5) in Visual Studio
    2. Everything's fine now

    For more details, you can check the issues oin github.

    Publish-NewServiceFabricApplication fails to read ApplicationManifest.xml

    If the above solution does not work, it is recommended to try the following steps.

    1. Create pkg/Debug folder.

    enter image description here

    1. I have some files under Debug folder, so I deleted them.

    enter image description here

    1. Clean and Rebuild Solution.

    enter image description here

    1. F5 Run. It will generate files you want.

    enter image description here