0

I am having a heck of a time getting a legacy web site to build.

I get a "Object reference not set to an instance of an object." but with no indication of where that is (not) being done.

I could work through the literally thousands of issues found by Resharper:

enter image description here

...in the hopes that fixing one or some combination of them would finally clear that error, but I figure a more sensible approach is to create a new project, and gradually add in the custom folders and classes, etc. The question is, though, which type of project to create: ASP.NET Empty Web Site, ASP.NET Web Forms Site, or what?

How can I tell which type of project the non-working legacy one is, so that I can emulate that? Is the information hidden in some configuration file? Can I tell based on which type of files are contained in the legacy project?

It has the following folders:

App_Browsers 
App_Code
App_Data
A ton of custom folders (one for each customer), each of which has "Default.aspx" and "Default.aspx.vb" files within it.

Then there are gobs of *.aspx files, vwd.webinfo, web.config, and website.publishproj

EDIT

This is not a duplicate of that question, or at least the accepted answer doesn't seem to apply, because there don't seem to be any .xml files in this project.

UPDATE

I am gradually adding in folders and files from the legacy project into a new project, and seeing at each step if anything has broken. Here is the odd thing: It Rebuilds fine (1 succeeded, 0 failed, 0 skipped); but a Build results in 0 succeeded, 0 failed, 1 updated, 0 skipped... Why does a Rebuild succeed, whereas a Build neither succeeds or fails - just updates?

Community
  • 1
  • 1
B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862
  • 1
    What specifically does the null reference exception say? It should provide some class name and/or stack trace. As for your question - your project is most likely webforms due to the aspx name – Allan S. Hansen Dec 02 '16 at 16:45
  • Nope - 2-clicking it goes nowhere, and there is nothing beneath File, Line, Column, or Project (see http://stackoverflow.com/questions/40875865/why-am-i-getting-object-reference-not-set-to-an-instance-of-an-object-but-no) – B. Clay Shannon-B. Crow Raven Dec 02 '16 at 16:47
  • 1
    So the old project seems to be Asp.Net Web Site as you said. Web site is an old style project without the project file, so you should create a new Asp.Net Web Application -project and use "Add existing item" -tool to import the files. Then select the project from the Solution Explorer and from "Project"-menu select "Convert to Web Application" it will create the missing files for example the aspx-pages needs. Good luck! – Esko Dec 02 '16 at 16:54
  • Before seeing Esko's comment, I created a new VB > ASP.NET Web Applcation, and got, "An item with the same key has already been added"; what?!? – B. Clay Shannon-B. Crow Raven Dec 02 '16 at 17:01
  • @AndrewMorton: At the link you provided, the accepted answer refers to "project XML files" but I see no .xml files in this project. – B. Clay Shannon-B. Crow Raven Dec 02 '16 at 17:03
  • @AndrewMorton: There is no "" in the .sln file, nor a "" – B. Clay Shannon-B. Crow Raven Dec 02 '16 at 17:11
  • Did you change the VS version to get the NRE? Based on some of the code shared with us heretofore, the NRE could be related to a bad class level declaration like `Private specialTextBox = TextBox118`. The `c#` IDE will note that there is a scope/context error - VB does not. (10,200+ errors/warnings is somewhat indicative too) – Ňɏssa Pøngjǣrdenlarp Dec 02 '16 at 17:11
  • I am using VS 2013; it is likely that the original was created with an earlier version of VS. – B. Clay Shannon-B. Crow Raven Dec 02 '16 at 17:12
  • @AndrewMorton: There is no .vbproj file, either. – B. Clay Shannon-B. Crow Raven Dec 02 '16 at 17:24

1 Answers1

3

There isn't a rock solid, guaranteed way but I've used this list in the past to help. In your project file (not the solution file) you look at the <ProjectTypeGuids> node. The guids listed in the value of that node are what the project is using. I've been able to bring legacy projects (more) up to speed by trimming some things out of that.

https://www.codeproject.com/reference/720512/list-of-visual-studio-project-type-guids

Note that this doesn't necessarily mean that your code will compile or run if you port it directly to a new project created with different project types. Frameworks and API's change, obviously.

squillman
  • 13,363
  • 3
  • 41
  • 60
  • Project file? I see *.sln, *.suo, *.master, *.aspx, *.aspx.vb, website.publishproj, vwd.webinfo, and web.config – B. Clay Shannon-B. Crow Raven Dec 02 '16 at 17:17
  • 1
    Ah, ok. If there is no project (*.vbproj) file then I think the most likely thing is that it was either a) imported from an existing web site or b) created using the New Web Site function in Visual Studio. In either case there is no project file and thus no project type. – squillman Dec 02 '16 at 17:22