Typed Settings from app.config or web.config not compiling



In Microsoft Visual Studio, you’ve defined new, typed settings in your app.config or web.config file either manually in the source editor or by using the settings GUI (right-click project, choose properties, then click on the “Settings” tab) and when you start writing code in your .cs or .vb file, the new settings aren’t available in intellisense and if you go ahead and type the names anyway, it won’t compile, even though you may have other settings already there that work just fine.


In your project’s “Properties” folder is file named Settings.Designer.cs or Settings.Designer.vb.  It is most likely set to “read only”.


Use Windows Explorer to remove the read only flag on the file, then go back into Visual Studio, right click the project, choose “properties”, then click on the “Settings” tab, then click “Synchronize” in the upper left corner of the settings page.  You may need to recompile.

Why did this happen?

There are a variety of reasons why this may happen, but one common cause is the following:

You had the project in Visual Source Safe, then you unbound the project from Source Safe.  Before, when it was bound to SourceSafe, whenever you opened any file for editing, the VSS plug in in Visual Studio checked the file out of SourceSafe and removed the read only flag.  Now that your project is not bound to VSS, the VSS plugin is no initiated when you attempt to edit a file, so if a file is read only, it stays that way.  Usually, for source files you edit directly, Visual Studio will warn you that it’s read only and ask you if you want to remove the read only flag.  But, for files that are generated by a tool like the settings editor, you are never prompted if you want to remove the read only flag.  As a result, Visual Studio acts like everything worked fine, even though it couldn’t write to the file.

Leave a Reply