narasimman narasimman - 6 months ago 46
C# Question

Publishing to Azure - MDF File is not found

I am developing a project with Visual Studio 2015 and trying to publish it to Azure. While publishing, it throws an error stating that .mdf file under

directory is not found.

I deleted it because I'm using Azure's DB.

Why should I keep the mdf file in the

Answer Source

Maybe you have created a mdf file inside the App_Data folder. The file is deleted from file explorer, but the file record haven't been removed from the project file. To check it, you could open your project file using notepad.

enter image description here

After opened the project file. You could search 'App_Data' to check whether there are content records like following. If yes, you just need to remove these records and save the project file.

<Content Include="App_Data\Database1.mdf" />
<Content Include="App_Data\Database1_log.ldf">
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download