This is a really annoying one. Basically, in Machine.config for the version of the framework you are developing against, there is an entry for LocalSqlServer.
On my machine, for version 4:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\Machine.config
<add name="LocalSqlServer" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />
I found that if I changed the data source part of the connection string to point at my Sql 2005 full server instance, then the error you mentioned went away.
(Similar for other versions of the framework, which I also changed)
I can't remember if I needed to restart just visual studio or the whole machine before I saw the changes work.
Remember to back up your machine.config files before editing them!
With that being said, there's also no reason why you can't add the database into Sql Server itself (if you have the mdf) then connect to it from Visual Studio via the View -> Server Explorer -> Data Connections (Right Click -> Add Connection) - have you tried that?
.mdf
file option is only available in the EXPRESS editions of SQL Server - all the others (web, standard, enterprise) do NOT support this option. If you have a full version of SQL Server, you need to create the database on the server, and then connect to it using a server connection string – marc_sconn String
... Thanks pro. – bonCodigo