0

I want to have one project that is linked to and uses another project.

I'm using ASP.NET. I have a solution file. It has many files and projects in it.

Recently, I made a new file called Testing that has two projects: Testing.Web (WebForms) and Testing.Core (Class library). Ignore ServiceA for the moment.

Directory

I added a reference to Testing.Core in Testing.Web.

Reference

Both projects target .NET Framework 4.

Testing.Web target framework

Testing.Core target framework

Everything builds. I can locally run the code until I try to invoke a .aspx pop-up that uses Testing.Core.

Server Error with Testing.Core

I made sure that the Testing.Core.dll referenced in Testing.Web (above) is in the correct location: \Testing\Testing.Core\bin\Debug\Testing.Core.dll.

The pop-up works if I remove references to the Testing.Core project. When I add it back, the Server Error message appears again.

I figured maybe there was a namespace issue, so I made the ServiceA project (first screen shot). It just has one class with a HelloWorld() method.

ServiceA code

I added a ServiceA reference to Testing.Web. I use ServiceA.dll by instantiating its one class and invoking its one method--same Server Error.

Server Error 2 with ServiceA

I checked the configuration manager. It all looks good there too.

Configuration manager

I looked at Testing.Web and Testing.Core's Properties > Build setup and made sure it was in line with what other Stack Overflow posts advised:

  • Define DEBUG constant checked
  • Define TRACE constant checked
  • Advanced > Debug Info: full selected

Testing.Web can reference other projects in the solution file (e.g., my Utilities project, which also targets .NET Framework 4).

It just doesn't seem to like any new class library that I make and try and link Testing.Web to.

I'm using Visual Studio Professional 2015.

I'm stuck. Any help would be hugely appreciated!

8
  • seems like the main namespace is "Testing". So try "using Testing.Testing.Core.Service"? Commented Feb 4, 2021 at 22:09
  • Unfortunately that didn't work. Commented Feb 4, 2021 at 22:13
  • I think things are getting confused by the double Testing namespace. Commented Feb 4, 2021 at 22:21
  • I thought that too. That's why I did the ServiceA experiment. But even with Testing.Web trying to reference ServiceA (Testing.Core fully removed), it results in the same error. Commented Feb 4, 2021 at 22:25
  • yeah, but ServiceA is in Testing namespace, no? so is Testing.Core and Testing.Web. Utilities is inside of Testing.Web namespace.. so it works since it's starting from there. Commented Feb 4, 2021 at 22:33

1 Answer 1

1

So, for anyone that has tried everything else with this error, here's what my issue was.

IIS (Internet Information Services), the software that is used to make a computer a web server.

I had IIS configured such that the binaries that the framework couldn't find (in my case, Testing.Core.dll and ServiceA.dll) needed to be manually put in the root directory's bin folder.

It didn't matter that Testing.Core and ServiceA were added to Testing.Web as a reference in Visual Studio--at runtime, debugging locally, it needed those .dll files in the root directory's bin folder.

FYI, someone who knows IIS better than I do said it's not good practice to have IIS set up this way, but it's what I inherited.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.