Robert Bengtsson
Robert Bengtsson

Reputation: 194

Intellisense not working when referencing non-dotnet core projects

I'm developing a .net core / asp.net core application in Visual Studio 2015 Update 3 that runs on the net46 framework in Azure. I'm having a few project files in my solution, some of them are written in dotnet core and some of them are imported from another solution (dotnet 4.6).

My solution builds and runs fine, but Intellisense (also running ReSharper) puts red squiggly lines under the code that references the non-core libs.

My project.json looks like this:

{
  "version": "1.0.0-*",
  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },
  "dependencies": {

    "Microsoft.AspNetCore.Diagnostics": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0-rc2-final",

    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-final",
    "Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final",
    "Microsoft.Extensions.Configuration.UserSecrets": "1.0.0-rc2-final",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0-rc2-final",
    "Microsoft.Extensions.Logging": "1.0.0-rc2-final",
    "Microsoft.Extensions.Logging.Console": "1.0.0-rc2-final",
    "Microsoft.Extensions.Logging.Debug": "1.0.0-rc2-final",

    "Autofac": "4.0.0-rc2-240",
    "Autofac.Extensions.DependencyInjection": "4.0.0-rc2-240",

    "AutoMapper": "4.2.1.0",

    "Microsoft.ApplicationInsights.AspNetCore": "1.0.0-rc2-final",
    "Microsoft.ApplicationInsights.TraceListener": "2.0.0",

    "XXX.SystemCore": "1.0.0-*",
    "XXX.Services": "1.0.0-*"
  },
  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": {
      "version": "1.0.0-preview2-final"
    }
  },
  "frameworks": {
    "net46": {
      "dependencies": {
        "XXX.SystemCore": {
          "target": "project"
        }
      }
    }
  },
  "publishOptions": {
    "include": [
      "wwwroot",
      "appsettings.json",
      "web.config"
    ]
  },
  "runtimeOptions": {
    "gcServer": true
  },
  "scripts": {
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}

The following projects are the non-core ones:

"XXX.SystemCore": "1.0.0-*",
"XXX.Services": "1.0.0-*"

They are also included in other solutions so I can't just convert them to core.

The wrapper-project.json looks like this:

{
  "version": "1.0.0-*",
  "frameworks": {
    "net46": {
      "bin": {
        "assembly": "../../../XXX.SystemCore/obj/{configuration}/XXX.SystemCore.dll",
        "pdb": "../../../XXX.SystemCore/obj/{configuration}/XXX.SystemCore.pdb"
      }
    }
  }
}

Please, how can I remove all the red squiggly lines from the referenced projects? :-)

Upvotes: 0

Views: 747

Answers (1)

Michael Auer
Michael Auer

Reputation: 11

I had exactly the same issue in Visual Studio 2015 after upgrading a web project from ASP.NET 5 RC1 to ASP.NET Core 1.0.0.

After ugrading, Visual Studio somehow included both classic (non-core) class libraries (.csproj) alongside the wrapper projects (.xproj) from the wrap folder. The wrap folder had been created by Visual Studio while working with ASP.NET 5 RC1.

Steps that helped in my case:

  1. Close solution and quit Visual Studio
  2. Remove the duplicated xproj-projects from the wrap folder in filesystem (or if possible remove the complete wrap folder).
  3. Open solution in Visual Studio und remove orphaned (wrap-)projects.
  4. Rebuild. In some cases I had to remove and re-add references to the classic (non-core) libraries.

Conclusion:

The wrap folder is not needed anymore (> RC2) to reference classic class libraries, but somehow - if still existent - seems to interfere with Visual Studio Intellisense

Upvotes: 1

Related Questions