简体   繁体   中英

Visual Studio: Publish a website to remote IIS and Push to GIT simultaneously

Can Visual Studio be configured to Publish (deploy) and Push (to GIT) simultaneously?

I have Visual Studio configured to "Publish" "only files needed to run this application" to a folder on a remote server which IIS is pointing to. When I make local changes, I can publish remotely easily.

I've also configured GIT for the project. The publish information is in the repo so that anyone can pull the project, make changes, and Publish. My general practice is to Pull, work, Push to GIT, then Publish the site--all using VS.

What is the best way to synchronize these actions? I don't want anyone to publish the app and forget to push to GIT at the same time.

I've worked with dev/production servers using typical web layouts before (ie push to git repo that IS the location of production files), but in this case that doesn't work because of the minimalist file structure of a "Published" site. I'd have to coordinate the exclude files in GIT with the files "not used" for publishing.

Visual Studio 2017, IIS 10.0

EDIT:

The GIT server as well as the project are hosted internally (albeit on different servers). Storing the code locally is a requirement, I cannot upload to TFS (so, so unfortunately).

Your requirement can be achieved in TFS/VSTS easily.

First, TFS/VSTS supports GIT version control, you can use it version control your project. You can refer to the following link for more details:

https://docs.microsoft.com/en-us/vsts/git/gitquickstart?view=vsts&tabs=visual-studio

Also, TFS/VSTS supports continuous integration and continuous deployment . A continuous integration trigger on a build definition indicates that the system should automatically queue a new build whenever a code change is committed. You can make the trigger more general or more specific, and also schedule your build (for example, on a nightly basis). You could also enable the Continuous deployment trigger, which will create release every time a new build is available.

https://docs.microsoft.com/en-us/vsts/build-release/actions/ci-cd-part-1?view=vsts

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM