none
Publish .Net Web site to Azure - using Visual Studio Command Line RRS feed

  • Question

  • Hi,

    I am publishing a .net site to Azure.

    It works from Visual Studio but I am having trouble doing exact same thing using Command line.

    So from VS, From publish Site option, I choose Web Deploy and I gave Server, Site Name, User Name, Password, Destination URL.

    Validated Connection and published site, it correctly update site on Azure. This is a Azure Web app. 

    I am trying to achieve same using command line. 

    Tried below command and its correctly publishing files to local folder.  

    C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -nologo -v / -p C:\MyWebsite -f -c -u C:\MyFolder1ToPublishSite

    Now I want to achieve two things. 

    1. How to use same command to publish this on Azure directly? any parameters to be added? 

    2. Let's say I already have a publish profile (.pubxml) for this site to be published on Azure, what will be the changes in this command to publish this site, using existing .pubxml file? 

    I tried adding parameter /p:PublishProfile but not working. 

    Thanks in advance, 


    • Edited by Sr. Developer-NY Wednesday, July 24, 2019 7:52 PM pasting the correct command which is working to publish on local folder
    Wednesday, July 24, 2019 3:08 PM

All replies

  • Hi 1977-Sr.Developer

    Thank you for posting here.

    As far as I know, the aspnet_compiler.exe is used to compiler to the application to the another folder. Normally, it is used to pre-compiler the application.

    If you want to deploy the application to Azure by using publish profile. I suggest you could use msbuild.

    More details, you could refer to below command:

    msbuild MyProject.sln
    /p:DeployOnBuild=true
    /p:PublishProfile=DeployToAzure
    /p:Configuration=Release
    

    Any feedback will be expected.

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Thursday, July 25, 2019 6:35 AM
  • Hi, Thanks for your reply. 

    I am able to publish to Azure using below command now. 

    C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild C:\MyWebSite /p:DeployOnBuild=True  /p:Configuration=Release /p:PublishProfile=C:\MyPublishedFile.pubxml

    The things I missed were --

    1. Need to use msBuild command from "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\", and I was using msBuild command from "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\"

    2. Need to use msBuild command, not aspnet_compiler.exe

    Thanks again for your help. 


    Thursday, July 25, 2019 6:05 PM
  • Hi Sr.Developer-NY,

    Thank you for your feedback.

    If you have other issue about MSBUILD tool, please feel free to contact us, we will try our best to provide a solution.

    Have a nice day.

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Friday, July 26, 2019 3:04 AM
  • Hi friend,

    It seems that you've found the Solution and resolve the issue yourself. You can mark it as answer so that other members with similar issue can find useful info from your answer easily.

    Have a nice day!

    Best Regards

    Lance


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, August 2, 2019 5:46 AM