Azure git deployment fails on referenced .config file-Collection of common programming errors

I am trying to deploy a simple mvc 4 project to windows azure using git. It works fine if I just publish it directly. The issue is basically in my web.config file I am referencing a MailSettings.config file for sending email like so:


  
    
  

I have ignored the MailSettings.config file in my git repository since it contains sensitive information. So it makes sense that the file isn’t found and I need to supply it some other way. The specific error I’m getting is:

Copying file MailSettings.config to C:\DWASFiles\Sites\testsite\Temp\05e169ef-8e7e-4246-9197-373cf66c3575\MailSettings.config failed. Could not find file 'MailSettings.config'

Is there is a simple way to handle this type of situation? I can upload the file separately through FTP, but how do I set up the git deployment in azure to skip the file? The git deployment is a nice feature. I appreciate any help!

  1. If the file isn’t in your git repo, you need to remove the reference to it from your csproj file, or it won’t build. Then you can just upload the file in the wwwroot folder via FTP so it’s available at runtime.