最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

.net - Error: pwsh: command not found while running workflow - Stack Overflow

programmeradmin4浏览0评论

This is how my YAML file looks:

name: "Build and Deploy"
on:
  workflow_dispatch:
    branches:
      - master
env:
  WEBAPP_NAME: 'IISAutoDeploy'
  DOTNET_VERSION: '8.0.x'           
jobs:
  build:
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v2
      - name: Setup .NET Core 
        uses: actions/setup-dotnet@v1
        with:
          dotnet-version: ${{ env.DOTNET_VERSION }}
          
      - name: Install dependencies
        working-directory: 'IISAutoDeploy'
        run: dotnet restore
        
      - name: Build
        working-directory: 'IISAutoDeploy'
        run: dotnet build --configuration Release --no-restore
        
      - name: Publish
        working-directory: 'IISAutoDeploy'
        run: dotnet publish --configuration Release --output 'dotnetcorewebapp'
        
      - name: Simply Web Deploy
        uses: RasmusBuchholdt/[email protected]
        with:
          website-name: ${{ secrets.WEBSITE_NAME }}
          server-computer-name: ${{ secrets.SERVER_COMPUTER_NAME }}
          server-username: ${{ secrets.SERVER_USERNAME }}
          server-password: ${{ secrets.SERVER_PASSWORD }}
          source-path: '/IISAutoDeploy/dotnetcorewebapp/'

I am using it to deploy my .NET Web API to IIS.

But when it reaches the last step, I am getting the following error:

> Run C:\inetpub\wwwroot\_actions\RasmusBuchholdt\simply-web-deploy\2.1.0/Scripts/Set-ApplicationPool.ps1 StopAppPool    
  C:\inetpub\wwwroot\_actions\RasmusBuchholdt\simply-web-deploy\2.1.0/Scripts/Set-ApplicationPool.ps1 StopAppPool    
  Error: pwsh: command not found

I have tried installing the PowerShell Core on my Server Then I tried adding a command in the yaml as well to install power shell core but the command was not recognized

This is how my YAML file looks:

name: "Build and Deploy"
on:
  workflow_dispatch:
    branches:
      - master
env:
  WEBAPP_NAME: 'IISAutoDeploy'
  DOTNET_VERSION: '8.0.x'           
jobs:
  build:
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v2
      - name: Setup .NET Core 
        uses: actions/setup-dotnet@v1
        with:
          dotnet-version: ${{ env.DOTNET_VERSION }}
          
      - name: Install dependencies
        working-directory: 'IISAutoDeploy'
        run: dotnet restore
        
      - name: Build
        working-directory: 'IISAutoDeploy'
        run: dotnet build --configuration Release --no-restore
        
      - name: Publish
        working-directory: 'IISAutoDeploy'
        run: dotnet publish --configuration Release --output 'dotnetcorewebapp'
        
      - name: Simply Web Deploy
        uses: RasmusBuchholdt/[email protected]
        with:
          website-name: ${{ secrets.WEBSITE_NAME }}
          server-computer-name: ${{ secrets.SERVER_COMPUTER_NAME }}
          server-username: ${{ secrets.SERVER_USERNAME }}
          server-password: ${{ secrets.SERVER_PASSWORD }}
          source-path: '/IISAutoDeploy/dotnetcorewebapp/'

I am using it to deploy my .NET Web API to IIS.

But when it reaches the last step, I am getting the following error:

> Run C:\inetpub\wwwroot\_actions\RasmusBuchholdt\simply-web-deploy\2.1.0/Scripts/Set-ApplicationPool.ps1 StopAppPool    
  C:\inetpub\wwwroot\_actions\RasmusBuchholdt\simply-web-deploy\2.1.0/Scripts/Set-ApplicationPool.ps1 StopAppPool    
  Error: pwsh: command not found

I have tried installing the PowerShell Core on my Server Then I tried adding a command in the yaml as well to install power shell core but the command was not recognized

Share edited Mar 10 at 10:54 jonrsharpe 122k30 gold badges268 silver badges476 bronze badges asked Mar 10 at 10:50 HakunaHakuna 5193 silver badges16 bronze badges 2
  • coulkd you try to reinstall the web deploy by downloading from this link: microsoft/en-us/download/details.aspx?id=106070 and for the pwsh command not found you could try this suggestion: stackoverflow/questions/77868495/… – Jalpa Panchal Commented Mar 11 at 3:14
  • @JalpaPanchal that did not help. Problem seems with web deploy script – Hakuna Commented Mar 13 at 18:40
Add a comment  | 

2 Answers 2

Reset to default 1

The action you’re using expects that MS WebDeploy V3 is installed at C:\Program Files (x86)\IIS\Microsoft Web Deploy V3

I would like to suggest you to first install the web deploy or repair it. if it is installed and make sure first hat the folder exist at C:\Program Files (x86)\IIS\Microsoft Web Deploy V3.i just checked the Set-ApplicationPool.ps1 it required the $msdeploy = "C:\Program Files (x86)\IIS\Microsoft Web Deploy V3\msdeploy.exe"; and you mentioned in the previous comment that this folder does not exist on your machine. So that indicate your script is failing because of that.

And it is not necessary to install the v3 you can install the v4. even after repairing you cannot find the folder just uninstall and install web deploy. And you could use this link to download the Web Deploy v4.0

Just make sure you have selected all the components while installing it

发布评论

评论列表(0)

  1. 暂无评论