Skip to content
This repository was archived by the owner on Dec 19, 2018. It is now read-only.
This repository was archived by the owner on Dec 19, 2018. It is now read-only.

Integration tests with ASP.NET Core causes missing references from Razor files #1212

@BrianVallelunga

Description

@BrianVallelunga

Title

Integration tests with ASP.NET Core causes missing references from Razor files

Functional impact

When attempting to run an integration test against an ASP.NET Core 1.1.1 site using the full .NET Framework, Razor views are unable to resolve references to namespaces like System

Minimal repro steps

  1. Build the attached
    IntegrationTestSample.zip
    solution.
  2. Run the site and confirm the home index page works
  3. Use the Test Explorer to run the GetHomeReturnsOKAsync test

Expected result

The test should pass with a successful OK response from the server.

Actual result

The test fails with errors such as:

[xUnit.net 00:00:06.8955637] XUnitTestProject1.Tests.GetHomeReturnsOKAsync [FAIL]
[xUnit.net 00:00:06.8973988] Microsoft.AspNetCore.Mvc.Razor.Compilation.CompilationFailedException : One or more compilation failures occurred:
[xUnit.net 00:00:06.8978938] 0q2sc41d.qfp(10,11): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
[xUnit.net 00:00:06.8984156] 0q2sc41d.qfp(11,11): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
[xUnit.net 00:00:06.8988809] 0q2sc41d.qfp(12,11): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
[xUnit.net 00:00:06.8993828] 0q2sc41d.qfp(15,36): error CS0234: The type or namespace name 'ViewFeatures' does not exist in the namespace 'Microsoft.AspNetCore.Mvc' (are you missing an assembly reference?)
[xUnit.net 00:00:06.8998931] 0q2sc41d.qfp(16,11): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
[xUnit.net 00:00:06.9003332] 0q2sc41d.qfp(18,86): error CS1980: Cannot define a class or member that utilizes 'dynamic' because the compiler required type 'System.Runtime.CompilerServices.DynamicAttribute' cannot be found. Are you missing a reference?
[xUnit.net 00:00:06.9007670] 0q2sc41d.qfp(18,86): error CS0518: Predefined type 'System.Boolean' is not defined or imported

Further technical details

This seems to be a regression of #755 and aspnet/Mvc#4686

Unlike those other issues, there is no third project involved here. Just the site and test projects.

This was not an issue until we switched to VS 2017 from VS 2015 (with project.json and xproj).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions