sdk: upgrade asp.net core targeting framework 4.6.1 from vs2015 to vs2017 - One or more compilation references are missing

have upgraded my asp.net core,using project.json and targeting .net framework 4.6.1 on visual studio 2015 to visual studio 2017.

I have multiple projects in the solution where the main application is referencing them by project reference(all of them target net461).

When running the application I get

One or more compilation references are missing. Possible causes include a missing 'preserveCompilationContext' property under 'buildOptions' in the application's project.json. Screenshot: 11

And my csproj: webapp.txt

I’ll try to create a project to see if I can reproduce.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 20 (12 by maintainers)

Commits related to this issue

Most upvoted comments

@livarcocc Looks like I found a way how to reproduce it:

  1. Create a new “ClassLibrary2”, targets “net461”.
  2. Create a new ASP.NET CORE app, targets “net461”
  3. Build ClassLibrary2 project into dll
  4. Add reference for web app to this dll
  5. Add to some razor page “using ClassLibrary2” (ClassLibrary2 - default namespace for the library)
  6. Run web app and you will see this error "The type or namespace name ‘ClassLibrary2’ could not be found (are you missing a using directive or an assembly reference?)

@using ClassLibrary2

example: WebApplication1.zip

I got the same error message, in my case I had to fully qualify my Model (@model Project.Namespace.Classname) and then it worked.

Best regards Dominic Rooijackers