简体   繁体   English

Visual Studio:将网站发布到远程IIS并同时推送到GIT

[英]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? 是否可以将Visual Studio配置为同时发布(部署)和推送(到GIT)?

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. 我已将Visual Studio配置为“发布”“仅运行该应用程序所需的文件”到IIS指向的远程服务器上的文件夹。 When I make local changes, I can publish remotely easily. 进行本地更改时,可以轻松地进行远程发布。

I've also configured GIT for the project. 我还为该项目配置了GIT。 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. 我的一般做法是:使用VS拉,工作,推送到GIT,然后发布站点。

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. 我不希望任何人发布应用程序而忘记同时推送到GIT。

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. 我之前使用过典型的Web布局来处理开发/生产服务器(即,将git repo推送到生产文件所在的位置),但是在这种情况下,由于“已发布”站点的文件结构极简,因此无法正常工作。 I'd have to coordinate the exclude files in GIT with the files "not used" for publishing. 我必须将GIT中的排除文件与“未使用”的文件进行协调。

Visual Studio 2017, IIS 10.0 Visual Studio 2017,IIS 10.0

EDIT: 编辑:

The GIT server as well as the project are hosted internally (albeit on different servers). GIT服务器以及项目都在内部托管(尽管位于不同的服务器上)。 Storing the code locally is a requirement, I cannot upload to TFS (so, so unfortunately). 将代码存储在本地是必需的,我不能上传到TFS(因此,很不幸)。

Your requirement can be achieved in TFS/VSTS easily. 您的要求可以在TFS / VSTS中轻松实现。

First, TFS/VSTS supports GIT version control, you can use it version control your project. 首先,TFS / VSTS支持GIT版本控制,您可以使用它对项目进行版本控制。 You can refer to the following link for more details: 您可以参考以下链接以获取更多详细信息:

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

Also, TFS/VSTS supports continuous integration and continuous deployment . 此外,TFS / VSTS支持持续集成持续部署 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 https://docs.microsoft.com/zh-cn/vsts/build-release/actions/ci-cd-part-1?view=vsts

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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