Creating project dependencies and adding a reference to the project still causes "Type or namespace name could not be found"

I have a solution in Visual Studio 2010 that contains 6 projects (1 web application, 4 C # class libraries, 1 C # console application).

The console application is my test harness and uses this to test external web services derived from methods from my other libraries and the general experiment. This test console application has only one dependency on another project dependency, one of the C # libraries.

The linked C # library is pretty simple:

namespace GowallaAPI
{
    public class Gowalla
    {
       private static readonly ILog log = LogManager.GetLogger(typeof(Gowalla));
       public SpotsInRadius GetGowallaSpotsInRadius(decimal lat, decimal lon, int radius) {
           //snip
       }
       //other methods removed for brevity//
    }
}

I added a link to the project in the console application:

enter image description here

And I also right clicked on the links and selected the Add Reference link ...

you can see the Gowalla reference already exists in this example picture

Then I went to the console application and added:

using Gowalla;

build. :

'Gowalla' ( ?)

. :

  • ( Gowalla) .
  • (, # 1), ( ...).
  • , , - .NET 4.0 - .
  • , Gowalla Build.
  • , , , .
  • .
  • , .
  • # Gowalla , ( 2).
  • Gowalla, :

    public Gowalla() {

    } ... !

- - ? ? , , " "...

.

1: Gowalla.dll, Reflector:

enter image description here

: , @gov GowallaAPI - , GowallaAPI. , :

private static readonly ILog log = LogManager.GetLogger(typeof(Gowalla));

log4net - . , ( log4net ), . @gov , !: D

+3
4

, .

@dooburt GowallaAPI , , , sample.common, , , , ,

+1

log4net, ".NET Client 4.0 Client Profile" ".NET Framework 4.0"

+8

Look at the target structure of your class library and test harness. I had this error when the class library was installed in .Net Framework 4 and the test harness was .Net Framework 4. Client profile.

+1
source

Take a look at the .csproj XML file, see if there is anything strange about the link, one of them:

  <Reference Include="Gowalla" ... />
  <ProjectReference Include=".\path to\Gowalla.csproj" ... />
0
source

Source: https://habr.com/ru/post/1794934/


All Articles