Can specify conditions on which replacement to occur via the xdt:Locator attribute:
<configuration>
<connectionStrings>
<add name="MyDB" connectionstring="conn string" xdt:Transform="Replace" xdt:Locator="Condition(@name='oldname')" />
</customErrors>
</connectionStrings>
</configuration>
Without the locator attribute all connection strings would be replaced.
Set the xdt:Transform attribute to RemoveAttributes() method, passing it the attribute to remove, e.g.:
<configuration>
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
</system.web>
</configuration>
Configure databases to deploy by right clicking project, going to Package/Publish SQL Settings.
Can use Import From Web.config button to configure any database already in web.config
If database does not exist on server deploying to then select Pull Data And./r Schema From An Existing Database check box. Use the Database Scripting Options list to choose between deploying schema, data, or both. Can also add SQL scripts to perform additional, custom configuration.
Package/Publish Web tab offers additional deployment options, e.g. which files to include, compression and encryption options, whether IIS settings not specified in web.config should be packaged, etc.
Right click and choose Publish.
Can save publish settings by providing it with a profile name. Settings include:
If not deploying directly, can package website into zip file for system administrators to install.
Destination server must have Web Deploy installed on it.
Zip file contains application.deploy.cmd which is sued to install deployment.
Post Visual Studio 2010 release by Microsoft.
Extends Visual Studio by adding UI to manage build configurations, merging and pre / post build tasks.
Allow site to be pre-compiled.
Can merge all files into single assembly, or assemblies for each page / control.
Provides strong naming of assemblies
Publishing websites requires specially configured web servers that permit publication to take place. Further, does not support distribution infrastructures requiring MSI packages.
Web Setup Projects provide highest level of deployment flexibility.
Similar to standard setup projects
Select File | Add | New Project | Add New Project
From available templates expand Other Project Types | Setup And Deployment | Visual Studio Installer | Web Setup Project
Project added to solution.
From File System Editor create project output group by right clicking Web Application Folder | Add | Project Output. From this dialogue select project to deploy, content files and configuration.
Can add further folders, files and assemblies that are not part of project output.
Not automatically built, must manually select project and build.
Defines server requirements for app installation, e.g. check specific version of Windows present.
To access go to View | Editors | Launch Conditions.
Right click Launch Conditions folder and add a new conditions.
Two main branches to Launch Conditions editor:
Typically add item to each of these nodes to require component as part of installation, e.g. to test specific DLL is present create Search Condition under Search Target Machine and store result of search in a property, then create Launch Condition that uses the search conditions property, if property not set then specify error message to display.
Right click Search Target Machine and choose from:
Right click Launch Conditions and select Add Launch Condition.
Access Properties window to configure launch condition.
Can set Condition property to match the Property value of a search, or specify different condition entirely. Provide URL in InstallUrl property to resolve launch condition. Set Message property to display to user when condition is not met.
The Condition property can be used to check operating system versions, variables, etc. To evaluate environment variables preface with %, e.g.
%HOMEDRIVE = "C:"
Condition can also check installer variables, e.g.
IISVERSION ="#6"
Can combine checks, e.g.
WindowsBuild=2600 AND ServicePackLevel=1
Can create common pre-grouped search and launch conditions.
Right click root node in Launch Conditions editor and choose from:
To access go to View | Editors | Registry.
To add nested key need to add each nested key above it to the editor.
Right click key to add setting, select setting type (String, DWORD, etc.) and then provide a name for the value.
Finally set the value property.
By default key not removed during uninstall, must set the DeleteAtUninstall property to true for this to occur.
To simplify installation configuration can add custom setup wizard pages and prompt user for install information.
Information collected here can then be passed as parameters to custom actions.
To access go to View | Editors | User Interface
Editor shows different setup phases for both standard and administrative users.
To add custom page right click setup phase to which you want to add and select Add Dialog - n.b. normally added to Start phase under Install mode.
Can customise available dialogue boxes by hiding some controls and displaying different labels.
Can run in any of four setup phases:
To access go to View | Editors | Custom Actions.
Right click phase to add custom action to then select Add Custom Action.
Select custom.exe or script file to execute at that phase of deployment.
To deploy web application to server use files (usually two) generated by build process:
Web Setup projects useful if providing website to many users.
If you are responsible for updating site it may be impractical to log on to server, copy over installation and run the msi - especially if frequent updates required.
Copy Web Tool can copy individual files or an entire site.
Select source and remote site and move files between them.
Can use to synchronise files - i.e. copying only changed files and detecting version conflicts, n.b. It cannot perform merges.
Launched from Visual Studio - right click site in solution explorer and choose Copy Web Site.
The Remote Site can be:
Tool will notify of conflicts with remote files, does not provide merging capabilities.
ASP.NET Websites (not web applications which are always pre-compiled) pages are compiled the first time they are accessed - performance hit for first visitor. Use pre-compilation to avoid:
Right click web site and select Publishing
Specify publishing location
In Publish Web Site dialogue select appropriate options:
Optional Windows Update package available to install .NET 4 onto computers.
After framework installed need to configure IIS to support ASP.NET 4 via the aspnet_regiis.exe - located in root of framework installation.