The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 4,224 other subscribers

Archive for February 29th, 2012

Solution for Visual Studio 2010 VB.NET errors “Type ‘MyProject.My.MySettings’ is not defined.” and “MyProject’ is not a member of [Defalut]” #VS2010

Posted by jpluimers on 2012/02/29

(Note the WordPress bug: you cannot have <Default> in a topic title, but having it in the text is fine, hence the [Default] in the title).

When porting some projects from .NET 1.x to .NET 4.x, I got these two errors:

Error 17 Type 'MyProject.My.MySettings' is not defined.
Error 18 'MyProject' is not a member of '<Default>'.

Both errors in the file ...\My Project\Settings.Designer.vb relative to the MyProject.vbproj file.

This was not the result of something like this Visual Studio 2005 bug, but of how the designer generated files are not being regenerated when you change the root namespace only in the MyProject.vbproj file, not through the IDE.

Steps to reproduce:

  1. Create a MyProject class library in VB.NET
  2. In the MyProject.vbproj, change the RootNameSpace into MyNameSpace.MyProject.vbproj
  3. Build

Lesson learned: when using text compare tools, some .vbproj changes should be propagated through the IDE, not through your favourite text compare tool.

When you change it in the IDE, it regenerates the *.Designer.vb files to reflect the changed namespace.

The solution is simple, in the IDE follow these steps:

  1. In the Project Options change the RootNameSpace to a dummy
  2. Build your project
  3. Chante the RootNameSpace to what you want
  4. Build your project

–jeroen

via: type “my.mysettings” “is not defined.” – Google Search.

Posted in .NET, Development, Software Development, VB.NET | Leave a Comment »

 
%d bloggers like this: