I'm programmign in ASP.Net, what's the correct syntax for this warning?
The namespace of this type doesn't match the project default namespace & directory
This appears for the name of Partial Class of my aspx page.
Thanks
RS
22 Answers, 1 is accepted
Thank you for your feedback. JustCode is warning you that the namespace of a given class does not match the relative path of the file, containing that class. For instance, suppose you have a project called "SampleProject" and a class in a file in the project's folder. Then the correct namespace for that class should be "SampleProject". However, if the class is in a file, which is in a folder "SubFolder" inside that project, then the correct namespace should be "SampleProject.SubFolder". Here is a simple example: http://screencast.com/t/RHyoQwrKV6 .
You have also the ability to disable that warning from the JustCode menu. Just select: JustCode->Options->Code Analysis->Warnings and the desired language for which to disable the warning.
Regards,
Ivan
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Public Class Test
Public Property Value As String
End Class
shows a green curly line under "Test" with the same warning message.

I have the same issue when using delegate definitions in my projects default namespace:
namespace My.Namespace
{
public delegate void MyDelegate (EventArgs e);
}
The file that holds this definition is in the root folder of the project. I wonder how to solve the namespace warning here...
Thanks,
Christ
Thank you for your feedback. We show this warning in all C# and VB.NET project types. If the file of the class you have is located directly in the VB project's directory and no namespace is defined explicitly, you should not get this kind of warning. However, if the file is in a subdirectory, a namespace matching the relative path to the project's main directory should be declared. For instance - Namespace SubFolder1.SubFolder2.
The idea is the same if you have a C# project. The only difference is that you should explicitly type the default namespace of the project. For example : namespace DefaultNamespace.SubFolder1.SubFolder2.
If you do that and still get this error, could you give us an information how to reproduce it, so we can fix it.
Your help is highly appreciated!
Regards,
Ivan
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

I am struggling with the same thing here?
I have just upgraded to the latest version ,ever since the upgrade i have had intellisense giving me this error?
I have a sub folder called invoices with a form called invoice.aspx contained within it,
the vb script is
Partial Class Invoice_invoice
End Class
This was fine before the upgrade but now gives a warning?
However the code runs fine, it just annoying?
Best Regards
Cush


Thanks very much,
That got rid of it.
Best Regards
Cush
The warning "Show warning for namespaces not matching project default namespace & directory on type identifiers" appears on type identifiers. For example - if you have a class is in a namespace that does not match the project default namespace & directory, the warning appears on the class name. Here is a demo : http://screencast.com/t/bkJkxBFfqIU . As for the other warning - it appears on the namespace name - http://screencast.com/t/ucTI9hjKzF9 . If you do not want to get this warning at all, you should disable both of them.
If you have more questions, please do not hesitate to contact us.
Your help is highly appreciated!
Regards,
Ivan
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>


The project name is:
PRJ.Core
The folder in wich the class is contained is called "Settings".
Yet if I use the namespace PRJ.Core.Settings in a class inside that folder I get the warning. Maybe A project name with . cause issues?
Thanks for contacting us.
I think that you have different warning than the mentioned in this topic. I think that you receive : "Name does not match the naming convention. Suggested name Prj.Core.Setting" which is caused by the acronym that you are using PRJ. By default JustCode supports acronyms which are two letters long. If you want to add some other acronym with different length you should add it manually at JustCode's menu > Options > Code Style > specific language (e.g. C#) > Naming Conventions . There in the right side window you will notice Allowed Acronyms text box. Add there PRJ and the warning will disappear.
I hope this will help you.
Thanks.
Please, do not hesitate to contact us if you have any further questions or need of assistance.
Zdravko
the Telerik team

Is there a way of flagging a folder to be ignored i.e. the App_Code folder so that the namespaces start from the folders within the App_Code folder. I would like a class called Membership found in the App_Code/Security folder to be in the namespace Security not App_Code.Security
Cheers
Chris
Yes, JustCode provides a "Do Not Contribute to Namespace" property inside Visual Studio's Properties window. All you need to do is select the folder in Solution Explorer and set the property value to "True".
Here is a short video showing how to do that.
If you have other questions, please do not hesitate to contact us.
Regards,
Telerik

Thank you for your prompt reply this sound perfect but I don't appear to get this option in the properties window when I select the app_code folder.
I'm running a trial version of JustCode 2013.2 726 at the moment on Visual Studio 2012 vs 11.06315.01 Update 2. Can you see any reason why this option would not appear?
Cheers
Chris
Unfortunately I cannot reproduce your problem. Could you please open a support ticket and, if possible, attach a sample solution to help us pinpoint the problem?
Thanks!
Siyka Marinova
Telerik

Ok no problem, we will be purchasing a full licence soon so I will see if that resolves the issue first.
Thanks for your time.
Cheers
Chris
There is one more thing I'd like to know, just to be sure we're on the right track: what type of project do you use?
Greetings,Siyka Marinova
Telerik

I am using a pre-existing project that would have been a C# Web Site, however I have also tried creating a Telerik project and had the same problem. Out of interest can this setting be manually configured in the settings xml file?
Cheers
Chris
Thanks for the additional information, it helped us clarify the problem. The "Do Not Contribute to Namespace" property is not available in WebSites and currently it is not possible to configure this setting manually. I logged an item for that in our backlog, so stay tuned!
Regards,Siyka Marinova
Telerik

Top-level Solution name: TicTacTokeWCFSvc
Project Name: Library
The name of my class is 'ITicTacToe.cs', and it's namespace is 'TicTacToeWCFSvc.Library'.
I see the error on my screen, and the directory/folder names and filenames all appear to be correct.
Attached is a screenshot of my VisualStudio2010 screen.
Nate

Hello Rodolfo,
I think you should try following syntax for the problem :
name = <namespace identifier> separator <local name> and get proper solution.
Thanks for sharing the post. Great job.....
Thanks for the screenshot.
The namespace should start with the current project name (e.g. Library) and then continue with the folder name (if there is any).
I am not sure what the warning says, but if you execute the "Fix Namespace" command from the Visual Aid > Fix menu your namespace should become 'Library', because this is your project name and the interface is not in a folder.
Thanks.
Zdravko
Telerik