.Net Core 2 run the `deploy.ps1` script after deployment

joel.mccune's Avatar

joel.mccune

16 Nov, 2017 05:13 PM

Hi

We have a .Net Core 2 application and the deployment works well.
What we would like to do is run the deploy.ps1 script after deployment.

How can we include the deploy.ps1 file in the project?
(The file will not exists in the GitHub repo because it is dynamically created. We have a copy of the deploy.ps1 file at build time.)

Thanks,
Joel

  1. 1 Posted by Ilya Finkelshte... on 16 Nov, 2017 08:13 PM

    Ilya Finkelshteyn's Avatar

    Can you please provide more context?

    • Do you use inline or Environment deployment (difference).
    • Do you use Web deploy or Deployment agent
    • Should this script be executed locally on the web server or on build machine?
    • Is web server located on your premises or it is some kind of web hosting like Azure AppService?
  2. 2 Posted by joel.mccune on 16 Nov, 2017 08:27 PM

    joel.mccune's Avatar
    • Do you use inline or Environment deployment (difference)? Environment
    • Do you use Web deploy or Deployment agent? Deployment agent
    • Should this script be executed locally on the web server or on build machine? locally on the web server
    • Is web server located on your premises or it is some kind of web hosting like Azure AppService? server located on premises

    Sample of our appveyor.yml

    deploy:
    - provider: Environment
      name: 
      site_name: 
      application_path: 
      apppool_name: 
      application_name: 
      on:
        branch: master
    
  3. 3 Posted by Ilya Finkelshte... on 16 Nov, 2017 08:41 PM

    Ilya Finkelshteyn's Avatar

    Thanks a lot for the clarification! You need to do the following:

    • add <Content Include="deploy.ps1" /> into .csproj file (in the same section with other includes) for your project. Add subfolder to the path if needed (if you create file not in the root site's folder)
    • create this file before build step (which contains WAP packaging)

    Let us know if this works.

  4. 4 Posted by joel.mccune on 16 Nov, 2017 10:46 PM

    joel.mccune's Avatar

    Thanks Ilya, this works

  5. joel.mccune closed this discussion on 16 Nov, 2017 10:46 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac