Click here to Skip to main content
14,970,948 members
Articles / Web Development / ASP.NET
Article
Posted 11 Oct 2013

Stats

10.2K views
1 bookmarked

How to stop creating the aspnetdb.mdf database

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
11 Oct 2013CPOL
If you use the asp.net membership providers, having visual studio keep this sql database file around for deployment can sometimes be convenient.

This articles was originally at wiki.asp.net but has now been given a new home on CodeProject. Editing rights for this article has been set at Bronze or above, so please go in and edit and update this article to keep it fresh and relevant.

If you use the asp.net membership providers, having visual studio keep this sql database file around for deployment can sometimes be convenient. However, what if you want to use your own production database specified in the web config for the membership tables and don't want this database to be created everytime you deploy to production? There is a solution to this problem. You simply disable this in the machine.config of your framework version. Here is how to turn this off.

  1. Browse using windows explorer to c:\windows\microsoft.net\framework\your dot net version\config
  2. Open the machine.config file in visual studio or notepad
  3. Scroll down until you get to a line for connectionstrings
  4. Comment out this line
    1. <add name="LocalSqlServer" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />
  5. Build your application

Once you delete the aspnetdb.mdf file and rebuild, it shouldn't come back again.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

ASP.NET Community
United States United States
The ASP.NET Wiki was started by Scott Hanselman in February of 2008. The idea is that folks spend a lot of time trolling the blogs, googlinglive-searching for answers to common "How To" questions. There's piles of fantastic community-created and MSFT-created content out there, but if it's not found by a search engine and the right combination of keywords, it's often lost.

The ASP.NET Wiki articles moved to CodeProject in October 2013 and will live on, loved, protected and updated by the community.
Group type: Collaborative Group

756 members


Comments and Discussions

 
-- There are no messages in this forum --