Solved

Add namespaces to converted vb.net web application project

Posted on 2015-01-08
4
288 Views
Last Modified: 2015-01-11
I'm refreshing a vb.net website in VS2013, and experimenting with converting it to a web application.  I've done all the steps of the conversion except adding namespaces to the code files.  There are maybe 150 to 200 code classes in roughly as many module and codebehind files.  

What are some ways to put all this code into a single namespace?

And will I have to change all the class.method calls to include that namespace? That is:

    dim exeG as new GetVars
    rtn = exeG.GetFirstVar(n)

would have to be

    dim exeG as new MyNameSpace.GetVars
    rtn = exe.GetFirstVar(n)

or if public shared,

    rtn = MyNameSpace.GetVars.GetFirstVar(n)

Because that might be more work than the conversion to web application would be worth, given time and budget constraints.
0
Comment
Question by:codequest
  • 2
  • 2
4 Comments
 
LVL 16

Accepted Solution

by:
Imran Javed Zia earned 500 total points
Comment Utility
Hi,

I don't remember any automatic way to perform this action. but you can Put the namespace under "Default Namespace" in project properties, and it doesn't need to be in the code files.

but for maintainability and readability I will recommend you to do it in each file.

Thanks
0
 
LVL 2

Author Comment

by:codequest
Comment Utility
Thanks for the input.  I think that's on the right track.  However, it still generates a many errors of these types:

'MPMenu' is not declared. It may be inaccessible due to its protection level.      
'MsgBox' is not a member of 'WebApplication1.App_Pages_blah_blah

These errors all seem to appear in the CodeBehind files, not in the class modules.  Also, these errors seem to be limited to some, but not all, ascx user controls + aspx files that have master files.

Any suggestions about those?  If not, I may accept your answer and ask another question.
0
 
LVL 16

Expert Comment

by:Imran Javed Zia
Comment Utility
You may have to cross check deginer.cs files.
0
 
LVL 2

Author Comment

by:codequest
Comment Utility
Thanks for the suggestion.  Can you elaborate on that?  I've never worked with the designer files before.  

There appear to be only a few code behind files affected, so if can resolve those, I'll be able to test the rest of the functionality for website vs web application.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now