.NET调试现有项目 [英] .NET debugging an existing project

查看:155
本文介绍了.NET调试现有项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,如果您能够了解以下问题,请随时跳过这个。

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

我还是非常新鲜的.NET,但是一个老老虎在老旧的ASP在常规VB。

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

我刚刚进入一家公司一些传统的.NET VB文件,现在我有几个巨大的项目,超过50mb的文件和大约1GB的整个项目和调试他们并不容易。我有阅读w3schools教程,并做了很多google研究,以达到这一点我只是不能做这个工作。而不同于另一个非常相似的问题我不认为这是一个简单的问题。

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.

我不知道这些项目是否是MVC或常规Web应用程序,但我被告知要使用 em>其他项目类型> Visual Studio解决方案>空白解决方案,然后添加现有网站。没有进一步的指示或方向,我看到他们都有DLL,让我相信他们不是MVC。

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.

无论如何,无论这个或许多其他方式我试图将文件添加到Visual Studio中,我无法正常使用其中的一个。一个工作得很好,我至少可以从网络服务器看到它在本地运行。但另一个给了我许多随机的错误和警告来编译调试并在Visual Studio自己的服务器上运行(我认为它是ASP.NET开发服务器)。有些错误不应该像XXX文件不存在一样存在,而我可以很容易地验证它是否存在

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.


  • 我有什么选择调试一个已经在调试中甚至错误选项的服务器中在线工作的大型Visual Studio项目?

  • 我如何知道如何正确地将现有项目导入Visual工作室开始?

  • 这是一个家庭作业问题吗?

  • (新)许多文件(本地,共享生产网络和直播)什么是处理和调试现有错误的最佳方法?开箱即用的想法总是受到欢迎(转换项目,不使用Visual Studio,旧版本,无论如何)

  • What options do I have to debug a big Visual Studio project that already works online in a server that have debugging and even error options turned off?
  • How can I know how to properly "import" an existing project into Visual Studio to begin with?
  • Is this a homework question?
  • (new) Given I have 3 places to sync many files (local, shared production network and live) what's the best approach to work on and debug existing errors? Out of the box thinking is always welcome (converting project, not using Visual Studio, older version, whatever)

推荐答案

听起来像你可能会有点在你的头上。我的第一步将是要求另一个开发人员帮助您,因为您正在进行真正的学习。

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.

在我进一步之前,您正在从一个本地副本..不是服务器一个,对吧?如果您将网络浏览到服务器,则需要立即停止。相反,将所有文件复制到本地目录并从中工作。然后去了解发布。直接从服务器上工作总是一个坏事(tm)。它与调试螺钉,更重要的是,这只是一个简单的错误。通常公司有一些类型的源或版本控制系统到位。用它。如果不存在,您可能需要将其启动。

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.

添加现有网站功能会添加网站项目,而不是Web应用程序或MVC应用程序。这3件事情是非常不同的。我会猜测你没有基于应用程序年龄的MVC应用程序。

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.

说明其他2种类型之间区别的最佳方式是.proj(project)文件是否存在于站点根目录中。如果它在那里,它是一个Web应用程序。如果不是网站。

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.

对于Web应用程序

如果是Web应用程序,请查看父文件夹看是否有.sln(解决方案)。如果是这样,在视觉工作室打开。

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.

如果.sln不存在(或者项目不在其中),则可以创建一个新的空白解决方案,然后单击添加现有项目。从那里浏览到.proj文件并添加它。

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应用程序没有编辑并继续,但确实有很多其他功能,这就是为什么没有人会使用网站。

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.

对于网站

创建空白解决方案,然后单击添加现有Web现场。浏览到包含该站点的文件夹,然后单击添加。

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

打开调试/错误

调试和错误选项纯粹在web.config中。只需更改您的本地配置并再次通过F5运行。

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.

一个最终注解

我强烈建议一次您确定这是一个网站还是Web应用程序,并且您开始尝试调试您创建自己的网站/ Web应用程序的野兽作为测试。找一个教程就可以了,有很多。您可以访问 asp.net 网站,并观看他们的培训视频。

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.

使用它来构建几个带有导航的网页,也可能是一些数据库连接。这可能需要几天的时间,但在此之前,您将在.net之前学习更多。

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.

现在有些人可能会说,有时候你必须在生产中进行调试。现实情况是,在生产中发现的问题只有分为两类:1.您没有使用正确的数据进行测试。 - 这意味着您的测试环境需要更好。或2.这是一个环境问题。解决#2的最佳方法是拥有一个与生产完全相同的分段服务器,您可以在推送之前进行最终测试。

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?

哪些导致我们的最后一块。如果您的项目是网站项目,请继续升级到Web应用程序项目。部署时,您不应该在此处复制代码。相反,一切都应该被编译。

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.

这篇关于.NET调试现有项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆