1

I am trying to publish a WebJob from Visual Studio manually ("Publish as Azure WebJob"). This project references other projects that between them have 3 database connection strings. When VisualStudio starts to publish, it automatically adds the three connection strings from the referenced projects.

This link explains that this in normal.

Avoid editing database-related settings in the .pubxml file, because Visual Studio changes these automatically as it finds changes in the project

I want to stop this behaviour as I define the connection strings to use in the App.config

How do I stop the publish profile including the connection strings automatically?

Sam Leach
  • 12,746
  • 9
  • 45
  • 73
  • 1
    You can override webjob app parameters from the config area of the website on the azure portal. The WebSite and the the webjob can share the same config. – Fabrizio Accatino Apr 10 '15 at 11:01
  • I know. But I would like to automate the publishing. Ideally from the Build but as second best, from Visual Studio. – Sam Leach Apr 10 '15 at 11:10

1 Answers1

0
  1. Install Microsoft Azure Configuration Manager
  2. Move your connection strings to the appSetting section (for debug purpose)
  3. Retrieve you connection string using the CloudConfigurationManager:

    var myConnectionString = CloudConfigurationManager.GetSetting("MyConnectionString");
    
  4. Your connection strings won't be updated anymore when you deploy your webjob.

Thomas
  • 24,234
  • 6
  • 81
  • 125