Answered by:
LightSwitch An exception occurred when building the database for the application

Question
-
Hi All,
Just installed LS Beta on Win 7 VM running VS 2010 Pro SP1 Beta.
I get this error when building after creating a table or connecting to a database:
An exception occurred when building the database for the application.
Method not found: 'Void Microsoft.Data.Schema.Sql.SchemaModel.ISqlSimpleColumn.set_IsIdentity(Boolean)'. C:\Program Files\MSBuild\Microsoft\VisualStudio\LightSwitch\v1.0\Microsoft.LightSwitch.targets 95 10 Application3Previous error leads to this part of "lightswitch.targets" line 95 Character 10 is first code after comment:
<!--The Development Database is built in the same location - Bin\Data - for all configurations.--> <BuildSchema Inputs="@(LightSwitchModel)" InstallDirectory="$(LightSwitchPath)" OutputDirectory="Bin\Data"/> <!--The _IntrinsicData connection string should be updated to use the absolute path since the Development Database is not under build output directory.--> <SetConnectionString ConfigFile="$(OutputPath)\web.config" Name="_IntrinsicData" ConnectionString="Data Source=.\SQLEXPRESS;AttachDbFilename='$(MSBuildProjectDirectory)\Bin\Data\ApplicationDatabase.mdf';Integrated Security=True;Connect Timeout=30;User Instance=True;MultipleActiveResultSets=True"/>
This is the information on my VS installation from 'help->about':
Microsoft Visual Studio 2010
Version 10.0.31118.1 SP1Rel
Microsoft .NET Framework
Version 4.0.30319 SP1RelInstalled Version: Professional
Microsoft Office Developer Tools 01018-532-2002102-70701
Microsoft Office Developer ToolsMicrosoft Visual Basic 2010 01018-532-2002102-70701
Microsoft Visual Basic 2010Microsoft Visual C# 2010 01018-532-2002102-70701
Microsoft Visual C# 2010Microsoft Visual F# 2010 01018-532-2002102-70701
Microsoft Visual F# 2010Microsoft Visual Studio 2010 Team Explorer 01018-532-2002102-70701
Microsoft Visual Studio 2010 Team ExplorerMicrosoft Visual Studio LightSwitch Beta 01018-532-2002102-70701
Microsoft Visual Studio LightSwitch BetaMicrosoft Visual Web Developer 2010 01018-532-2002102-70701
Microsoft Visual Web Developer 2010Crystal Reports Templates for Microsoft Visual Studio 2010
Crystal Reports Templates for Microsoft Visual Studio 2010Microsoft Package Manager 1.0
Package Manager in Visual StudioMicrosoft Visual Studio 2010 Professional - ENU Service Pack 1 (KB983509) KB983509
This service pack is for Microsoft Visual Studio 2010 Professional - ENU.
If you later install a more recent service pack, this service pack will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/983509.Microsoft Visual Studio 2010 SharePoint Developer Tools 10.0.31118
Microsoft Visual Studio 2010 SharePoint Developer ToolsTelerik MVC VSExtensions 2010.03.1109.0
Telerik Extensions for ASP.NET MVC VSExtensions PackageTelerik OpenAccess ORM 2010.3.1125.1
Telerik OpenAccess ORM Copyright (C) 1996-2010 Telerik; OpenAccess is the Object-Relational Mapping Tool for the Microsoft .NET Platform. www.telerik.comTelerik Reporting
For more information please visit http://www.telerik.com/reporting. Copyright © 2005–2011 Telerik, Inc.Telerik Silverlight VSExtensions 2010.03.1109.0
Telerik RadControls for Silverlight VSExtensions PackageTelerik UserSettings VSExtensions 1.0.0.0
Package for performing configuration of the Telerik VS ExtensionsTelerik WebUI VSExtensions 2010.03.1214.0
Telerik RadControls for ASP.NET AJAX VSExtensions PackageTelerik WPF VSExtensions 2010.03.1109.0
Telerik RadControls for WPF VSExtensions PackageThanks for any guidance you can give.
Dave
Thursday, January 6, 2011 2:37 AM
Answers
-
The failure to auto attach a database sounds a little similar to the problem reported in the following thread.
http://social.msdn.microsoft.com/Forums/en/lightswitchgeneral/thread/219f42cf-5c99-4a72-9acb-249210c835e2
For anyone about to reformat their PCs, it might be worth clearing the files in the following folder to see if it fixes the problem.
%LOCALAPPDATA%\Microsoft\Microsoft SQL Server Data\SQLEXPRESS- Marked as answer by DSBHS82 Friday, January 14, 2011 8:41 PM
Friday, January 14, 2011 9:55 AM
All replies
-
Facing the same "Method not found" error as well... Error 1 An exception occurred when building the database for the application. Method not found: 'Void Microsoft.Data.Schema.Sql.SchemaModel.ISqlSimpleColumn.set_IsIdentity(Boolean)'. C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v1.0\Microsoft.LightSwitch.targets 95 10 Application3Monday, January 10, 2011 6:08 AM
-
Update to my previous post!!
Tested in 3 different machines (Vista & Win7 - Visual Studio 2010) and getting the same error. However by clicking "YES" to continue to see the Output brings the screen with another error, says "An attempt to attach an auto-named database for file <location>\DevelopmentDatabase.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share".
- Proposed as answer by PowerBala Friday, January 14, 2011 12:35 AM
Monday, January 10, 2011 6:17 PM -
Format the PC and reinstalling OS and VS 2010 back solved the issue on all three machines.
It may not be the proper solution, but working for me.
- Proposed as answer by PowerBala Friday, January 14, 2011 12:39 AM
Friday, January 14, 2011 12:39 AM -
The failure to auto attach a database sounds a little similar to the problem reported in the following thread.
http://social.msdn.microsoft.com/Forums/en/lightswitchgeneral/thread/219f42cf-5c99-4a72-9acb-249210c835e2
For anyone about to reformat their PCs, it might be worth clearing the files in the following folder to see if it fixes the problem.
%LOCALAPPDATA%\Microsoft\Microsoft SQL Server Data\SQLEXPRESS- Marked as answer by DSBHS82 Friday, January 14, 2011 8:41 PM
Friday, January 14, 2011 9:55 AM -
Thank you Tim,
The advice and information in the thread you provided did the trick!
Thanks also to PowerBlaga for all the information you provided about how you got through your similar problem.
Friday, January 14, 2011 8:47 PM -
Help Please!
I have the same problem as described above I have tried deleting files in (%LOCALAPPDATA%\Microsoft\Microsoft SQL Server Data\SQLEXPRESS) but it seems to have no effect. I am running Windows 7 32bit with Visual Studio 2010 Pro SP1 installed along with a whole host of other Apps so formatting the drive and reinstalling is not really an option. This appears to be a common problem and is not well documented.
Does anyone have any other ideas or information? I am ready to give up on lightswitch.
Thursday, April 7, 2011 8:08 AM