The process cannot access the file 'ApplicationDatabase.mdf' because it is being used by another process. - by MyRBC

Status : 

  By Design<br /><br />
		The product team believes this item works according to its intended design.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 690422 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 9/23/2011 4:20:15 AM
Access Restriction Public


When I attach the 'ApplicationDatabase.mdf' to SQL Server management Studio; I do not manage to build the Lightswitch application. I get following error: The process cannot access the file 'ApplicationDatabase.mdf' because it is being used by another process.
Sign in to post a comment.
Posted by MyRBC on 12/15/2011 at 1:53 PM
Hi Valerie Andersen, LightSwitch Program Manager,

Please notice as soon as I touch the database with Visual Studio or SQL Server Management Studio; no access to the database. FULL CRASH!

What will be the workaround to insert data from "Database_A.mdf" to LightSwitch database "ApplicationDatabase.mdf" during development?

I need you to open access to the database "ApplicationDatabase.mdf" from SQL Server Management Studio to insert data during development.

When will LightSwitch SP1 come out?

We love LightSwitch!
Super Duper Product!
...but we still need some help!

Thank you,
Mr. Brattas

Posted by MyRBC on 11/9/2011 at 2:39 PM
...please notice I like to use the SQL Server with the Visual Studio during my development.
Posted by Microsoft on 11/9/2011 at 12:48 PM
You should be able to successfully insert data via the Server Manager in Visual Studio which will allow you to connect to the .mdf file without hindering your application.
Posted by MyRBC on 11/9/2011 at 8:48 AM
I like to insert rows by programming, from excel sheet or from other database using the SQL Server into the Lightswitch database; using the SQL Server during design time. Plus I like to change the data in the Lightswitch database using a query in the SQL server...I flip alot between Visual Studio and SQL Server during design time. It freak me out when I cannot access the Lightswitch database from the SQL Server; it is a reason we have the SQL server…hehehe... :)
Posted by Microsoft on 11/9/2011 at 7:27 AM
Can you help me understand what it is you want to do in the database during design time? As I said previously, using a full sql version during debugging is not supported by LightSwitch. The only supported database to use during development is SQL Express in user instance mode. This is required to enable LightSwitch to have full control to manage the database during development. There is not a way to use any other version of SQL for your design-time work. The only workaround would be to deploy your application as a part of your development process so you could make the changes you need to in a full SQL database version. You could do a simple 2-tier deployment on your local development box to make it as simple and quick as possible. You can also attach to the .mdf file to do some basic t-sql against the db via the Visual Studio Server Explorer. This connection will not hinder the build like attaching the db file to another sql server does.
Hope that helps!
Posted by MyRBC on 11/3/2011 at 12:47 AM
OK, but I need access to the database through development of Lightswitch.
How do I work around this issue till it's fixed for next version.
Could you please add a comment in the workaround tab?

Plus I like to remove the SQL Express database with the Enterprise datadase. But when I add the Enterprise database and create a new table; the new table is created in the Express database.
...I am looking forward to see some changes here... :)
Posted by Microsoft on 11/2/2011 at 2:13 PM
Thank you for your feedback. This functionality is By Design. The development database used at debug time is required to be a dedicated user instance SQL Express database. When the file is attached to an existing sql server it can no longer be run in user instance mode as the database file will be in use as the error message indicates. Full versions of SQL Server are not supported for the intrinsic store at debug time in v1.
Valerie Andersen
LightSwitch Program Manager
Posted by MS-Moderator08 [Feedback Moderator] on 9/25/2011 at 11:27 PM
Thank you for your bug submission. We have passed your issue along to the LightSwitch team for investigation.
If this issue is severe, causing critical business situations or blocking your product development or deployment, please go to or call 1-800-MICROSOFT for assistance.
Posted by MS-Moderator01 on 9/23/2011 at 4:46 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(