how to change the connectionstrings of a lightswitch application in debug mode

Fabiyi Tunde picture Fabiyi Tunde · Nov 9, 2012 · Viewed 7.6k times · Source

please how do i change the connection string of a lightswitch application for debugging purposes . i have followed this post http://dougseven.com/2010/08/23/data-storage-in-visual-studio-lightswitch-2/

but i can seem to get it to work. anytime i change the web.config in the applicationroot/bin/debug when i run the application in debug mode the file gets recreated with the original value in the file.

i have no problem changing it when publishing the app.

and when i implement the change in the applicationdefinition.lsml file it has no effect

Answer

dani herrera picture dani herrera · Nov 9, 2012

From Andy Kung lightswitch team:

If you attach to an external datasource, you can right click on that node in the Solution Explorer and select "Update Datasource" to modify the server info without recreating your screens.

EDITED

... but is not true.

You should change applicationroot/ServerGenerated/Web.config instead applicationroot/bin/debug/web.config.

Explanation:

If you turn to File View, in Data/ApplicationDefinition.lslm they are a reference to your connection string:

Then in project\ServerGenerated\Web.config locate the connection string:

<connectionStrings>
    <add name="_IntrinsicData" ... />
    <add name="e8f0cfed-653d-42fc-9617-bcaee11eed91" connectionString="HERE!!!!!!