Kostya Vyrodov
Kostya Vyrodov

Reputation: 7277

How to publish a file only once? ASP.NET vNext

I have a config file which contains version of some client. I need publish this file only once, and it should be same after every publish of web app. How can I do it? I use Visual Studio Online for continuous deployment and after every push web app in the qa server is updated.

Upvotes: 0

Views: 87

Answers (1)

Eddie Chen - MSFT
Eddie Chen - MSFT

Reputation: 29976

You can use Web Deploy to publish your web app.

By default, Web Deploy determines which files need to be copied to the server by comparing the dates that the local files were last changed against the dates that the server files were last changed. If you use a source control system that changes file dates when you check out files, it appears that they have all changed, and Web Deploy copies them all to the server when you publish.

An alternative for this scenario is to configure Web Deploy to use file checksums to determine which files have changed. Use checksums only if file dates are unreliable indicators of what has changed, because comparing checksums takes more CPU processing time than comparing dates.

Or:

You can limit the files that are deployed by selecting the Only files needed to run this application or All files in this project options on the Package/Publish Web tab. If you select the All files in this project option, you can right-click a file in Solution Explorer and select Exclude From Project to keep it from being deployed. For more information about what files are excluded when you use the Only files needed to run this application or All files in this project options, see Why don't all of the files in my project folder get deployed?.

If these options are not flexible enough for you, another option is to edit the .pubxml or the .wpp.targets file and add an ExcludeFilesFromDeployment element or an ExcludeFoldersFromDeployment element (or both) in the PropertyGroup element. In each element, you can specify a single name, or you can specify multiple names delimited by semicolons (;), as shown in the following example:

Upvotes: 2

Related Questions