U4-7944 - Deployment to Azure fails after NuGet install

Created by Pieter Dubelaar 11 Feb 2016, 16:19:06 Updated by Lars-Erik Aabech 22 Mar 2016, 09:31:47

Duplicates: U4-4510

I've run into this using Umbraco 7.3.7. If you create a blank Visual Studio project, download Umbraco via NuGet, and create an Azure publish profile, the deployment fails throwing an error "The 'Connection String' argument cannot be null or empty."

Steps to reproduce: In Azure:

  • Create a new Web App

In Visual Studio 2015:

  • file > new > project.
  • Choose 'ASP.NET Web Application'.
  • Choose the 'Empty' ASP.NET 4.5.2 Template. Uncheck 'Host in the cloud' under Microsoft Azure.

After the project is created:

  • Tools > NuGet Package Manager > Package Manager Console.
  • run 'Install-Package UmbracoCms -Version 7.3.7'.

Once installed

  • Build the solution
  • Rightclick project > 'Publish...'.
  • Choose 'Microsoft Azure Web Apps'.
  • Pick the Web App created earlier.

MSBuild will now choke on the fact 'connectionString' and 'providerName' are empty in the web.config:

The error given in Visual Studio:2> C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.Web.Publishing.targets(4276,5): Error : The 'Connection String' argument cannot be null or empty.

I naively added a connection string, assuming (hoping) the installer would pick up on the fact the connected database did not have Umbraco installed (and the fact was still empty) and would do a clean install. It doesn't, instead throwing an error on /install/api/GetSetup: "Message":"An error has occurred.","ExceptionMessage":"Invalid object name 'umbracoUser'.","ExceptionType":"System.Data.SqlClient.SqlException".

The best way to publish the site directly to Azure, seems to be to remove the umbracoDbDSN keys altogether.


Vincent Baaij 12 Feb 2016, 07:43:26

@pieter you need to do 2 things before you can deploy: 1) build the solution (as it says in the readme. 2) start the site locally so that the setup runs. The setup will set the umbracoConfigurationStatus and the connectionstring (you can enter the connectionstring to the db you already have and it will add all the tables etc)

Pieter Dubelaar 12 Feb 2016, 09:09:10

@vnbaaij thanks for the reply! Part of the reason for submitting this exception is to help Umbraco become more resilient to misuse. There obviously is 'the' right way to install it. But we make assumptions on how to deploy a system. The more accepting a system is of installation procedures other than the right way, the more mature a system feels. This is more of a 'feature request' - change the CMS in such a way that common mistakes don't lead to Yellow Screens Of Death, but are gracefully accepted. A quick win would be to sanity check the state of both the web.config (both umbracoConfigurationStatus and connectionString, not just the first) as well as the database the connection string links to.

Lars-Erik Aabech 22 Mar 2016, 09:31:19

Solution for this is to add <AutoParameterizationWebConfigConnectionStrings>false</AutoParameterizationWebConfigConnectionStrings> to Project\PropertyGroup in the .pubxml file under properties\publishprofiles, and <UpdateDestWebConfig>False</UpdateDestWebConfig> to ItemGroup\MsDeployParameterValue.

Not much HQ can do to mitigate this.

Priority: Normal

Type: Exception

State: Duplicate


Difficulty: Normal


Backwards Compatible: True

Fix Submitted:

Affected versions:

Due in version:


Story Points: