Archive for the 'ADO.NET' Category

May 20 2008

app.config closes on Save in VS 2008

Published by Raja Nadar under ADO.NET, bugs, vs 2008

working with .NET 3.5, ADO.NET Entity Framework and VS 2008, there are a couple of bizarre (also annoying) actions, you can see.

  1. an App.config/Web.config file is automatically closed by the VS 2008, when you Save the file.
  2. if multiple config files are open, only the first one is closed.

 

this doesn’t happen to all XML files. only parent application configuration files. it does not seem to affect the child config files. (linked files which have their own section, which do not have a root <configuration> section)

so initially I thought, the closing action seems to be related to a configuration file which has this:

 

<?xml version=”1.0″ encoding=”utf-8″?>

<configuration> — blah — </configuration>

 

but that is also not totally true, because the App.config if renamed, does not close on Save.

so it has got something to do with the file name too.

it seems many of the developers have hit this annoying issue, and the problem seems to be the ADO.NET Entity Framework.

 

in order to verify this, I performed the following steps:

  1. I checked the ADO.NET entity tools installed on my box, and found the following:
    • ADO.NET Entity Framework 1.0 (Pre-release Version Beta 3)
    • ADO.NET Entity Framework Tools Preview ( #1.a is a pre-requisite for this)
  2. I uninstalled ADO.NET Entity Framework Tools Preview, and checked the app.config/web.config behavior. spot on.. the file did not close. this is the culprit.
  3. to verify further, I uninstalled ADO.NET Entity Framework 1.0 and checked. the file did not close on SAVE.
  4. then I installed ADO.NET Entity Framework 1.0, and tried saving the config file. it did not close.
  5. I installed ADO.NET Entity Framework Tools Preview, and tried saving the config file. it closed.

ADO.NET Entity Framework Tools Preview, is the one, messing up with the configuration file save action.

Notes:

  1. During its installation, ADO.NET Entity Framework Tools Preview, prompts for VS 2008 to be closed, if it is open. goes on to show that, it installs some related packages/plug-ins which have the side effect.
  2. to resolve this issue, I renamed my app.config file, to <Assembly>.EXE.Config and worked with it.
  3. for applications where renaming did not make sense, I just use an external editor. I got tired of editing a small value, saving it (close) in VS 2008 IDE, and finding it and opening it again.
  4. ADO.NET Entity Framework 1.0 (Pre-release Version Beta 3) can be downloaded here.
  5. ADO.NET Entity Framework Tools Preview can be downloaded here.
  6. this bug has been logged with the ADO.NET Entity Framework team.

 

there’s a solution to every problem; given enough time and money..

4 responses so far