cregox
cregox

Reputation: 18390

.NET debugging an existing project

Background / Disclaimer

First of all, please feel free to skip this entirely if you can understand the questions below.

I'm still very fresh new to .NET, but an elder monkey on bad old ASP in regular VB.

I just got into a company with some legacy .NET VB files and now I have a couple of huge projects, with over 50mb of files and about 1gb the whole project and debugging them haven't been easy. I've read through w3schools tutorial and did many google researchs to get to this point in which I just can't make this work. And unlike in another very similar question I don't think this is a simple issue.

I don't know if those projects are MVC or regular Web Application, but I was told to use "Other Project Types > Visual Studio Solution > Blank Solution" and then "Add Existing Web Site" to that. With no further instructions or orientation, I see they all have DLLs and makes me believe they are not MVC.

Anyway, whichever this or many other ways I've tried to add the files into Visual Studio, I could never use the Debug properly with one of them. One works fine enough, I can at least see it running locally very alike from the webserver. But the other gives me many random errors and warnings to "compile" the debug and run on Visual Studio's own server (I think it's called "ASP.NET Development Server"). Some errors shouldn't even exist like "The file XXX doesn't exist" while I can easily verify it does exist!

I don't really expect to have much help here, but I still hope to find some. Sorry if this is too much.

Questions

Upvotes: 3

Views: 579

Answers (1)

ChrisLively
ChrisLively

Reputation: 88044

Sounds like you might be a little bit over your head. My first step would be to ask another dev there to help you out because you are in for a real learning ride.

Before I go any further, you are working from a local copy.. not the server one, right? If they have you browsing across the network to the server, then you need to stop that right now. Instead, copy all of the files to a local directory and work from it. Then go learn about publishing. Working directly off of the server is always a Bad Thing(tm). It screws with debugging and, more importantly, it's just plain wrong. Usually companies have some type of source or version control system in place. Use it. If it's not there, you might want to bring it up.

The Add Existing Web Site feature adds a Web Site project, not a Web Application or MVC app. These 3 things are very different from each other. I'm going to take a guess that you don't have an MVC app based on the age of the application.

The best way to tell the difference between the other 2 types is whether or not a .proj (project) file exists in the root of the site. If it is there, it is a web application. If not it is a web site.

For a Web Application
If it is a web application, look in the parent folder to see if there is a .sln (solution). If so, open that in visual studio.

If the .sln doesn't exist (or the project isn't in it) then you can create a new blank solution and click Add Existing Project. From there browse to the .proj file and add it.

At this point look in the Solution Explorer to see if you can find all of the files. Most likely, the missing ones are not included in the project. If you don't see them, then click on the "Show All Files" button at the top of the solution explorer. Then you locate them on, right click, and say add to project.

Web applications do not have edit and continue but do have a whole lot of other features which is why no one uses web sites anymore.

For a Web Site
Create the blank solution, then click Add Existing Web Site. Browse to the folder containing the site and click add.

Turning on debugging/errors
The debugging and error options are purely in the web.config. Just change your local config and run it again via F5.

One Final Note
I would highly suggest that once you determine whether this is a web site or web application and BEFORE you begin trying to debug this beast that you create your own web site/web application as a test. Find a tutorial on this, there are many. You might go to the asp.net site and watch their training videos.

Use that to build a couple web pages with navigation and maybe some database connectivity. It might take a couple days but you will learn a lot more before about .net in that time.

UPDATE FOR NEW QUESTION
Not just the Best, but really only place you should be debugging is off of your local copy. Debugging on a shared file set doesn't work to well (lots of security problems with network drives) never mind the fact that multiple devs might be working out of that shared area and debugging off of a live production server is a huge no-no.

Now some people might say that there are times when you have to debug in production. The reality is that issues found only in production fall into exactly two categories: 1. you aren't testing with the right data. - which means your test environment needs to be better. Or 2. it is an environment issue. The best way to solve #2 is to have a staging server which is absolutely identical to production which you do final testing on before pushing to live.

If you still think you have to debug in production, consider the impact of making a slight change which completely kills your site. Sure you can roll that change back quickly, but how many people did you just totally piss off. More importantly how many of them are customers and/or execs?

Which leads us to the final piece. If your project is a Web Site project, then go ahead and upgrade it to a Web Application project. When you deploy, you shouldn't be copying code out there. Instead, everything ought to be compiled.

Upvotes: 3

Related Questions