2

I have an azure web role with Azure SDK 2.3. My web site project website has web.config, which gets copied to bin/debug/website.dll.config properly during build. But Azure SDK totally fails to include this DLL in the cspkg which causes my role OnStart to fail, since it depends on binding redirects in the web.config to load the correct version of the Azure runtime assemblies. Anyone got any bright idea why cspack isn't including this file and what to do about it?

Tim Lovell-Smith
  • 15,310
  • 14
  • 76
  • 93

1 Answers1

2

web.config files are never copied as projectNAme.dll.config!

Only application.config files are copied this way. And yes, for Web Roles nothing beside the regular web.config are automatically copied.

You have to name your configuration file following the name of your main application assembly (i.e. website.dll.config) and then explicitly mark it with Copy Always in the properties panel, section Copy to output folder. Thus the file will be included into the web role package.

astaykov
  • 30,768
  • 3
  • 70
  • 86
  • Something, somewhere, made me think the file *is* supposed to be copied. If only I could remember what that was... – Tim Lovell-Smith Sep 04 '14 at 14:45
  • 1
    "web.config files are never copied as projectName.dll.config" -- but precisely that is the default behaviour when you _Build_ an Azure project in Visual Studio. Yet it is excluded when you Package/Publish. Why should they never be copied? – ledneb Jun 04 '15 at 10:38
  • do you end up having to have both a web.config and a .dll.config? – tofutim Nov 20 '15 at 05:38
  • 2
    oddly, I find that Web.config files (as of VS2015, Azure 2.8) are copied into projectName.dll.config in the bin directory. But unless there is a reference to projectName.dll.config with Copy Always, it never makes it into Azure. AND if you rename Web.config to projectName.dll.config, nothing gets copied to the bin directory. Crazy stuff. – tofutim Nov 20 '15 at 06:11
  • interesting. but web.config goes anyway as web.config in the siteroot folder. so why would you need the assembly specific config too ? – astaykov Nov 20 '15 at 09:27
  • 1
    @astaykov need it as per the question: 'But Azure SDK totally fails to include this DLL in the cspkg which causes my role OnStart to fail, since it depends on binding redirects in the web.config to load the correct version of the Azure runtime assemblies' - i.e. the failure is when OnStart is called. – Tim Lovell-Smith Jan 11 '16 at 19:33