How can I configure the Razor Language Service in Visual Studio 2017?
daiplusplus opened this issue · comments
(Alternative title: "Bug report: No documentation available regarding configuring Razor Language Services in Visual Studio 2017".)
Steps:
- Open Visual Studio 2017 (I'm running Enterprise 15.8.5)
- Create a new C# .NET Framework 4.7.2 Class Library project (not .NET Core or .NET Standard)
- Open the Project Properties and specify C# language version 7.3.
- Create a new
.cshtml
file in the project root.- As there isn't an item-template for Razor files I used the HTML Page template and renamed the file extension to
.cshtml
.
- As there isn't an item-template for Razor files I used the HTML Page template and renamed the file extension to
- Open the file and the Text Editor with the Razor Language Service runs.
- Observe that IntelliSense and design-time build errors indicate and with no custom assembly references, not even
System.Core.dll
so Linq isn't available. - Add a new C# class
MyProject.TestClass
to the project in its own.cs
file.
Observations:
- The Razor Language Service is using the C# 4.0 compiler, not the C# 7.0 compiler.
- Classes in my project like
TestClass
are acessible in the Razor file, but not types defined in other assemblies referenced by my project (e.g.System.Linq.Enumerable
inSystem.Core.dll
) - There doesn't seem to be any way to configure the Razor Language Service.
Hi, the best place for for bug reports and feedback about Visual Studio is https://developercommunity.visualstudio.com/spaces/8/index.html
This repo is the .NET Core Razor support.
@rynowak But this is the repo that also contains the Razor Language Service, used by both .NET Core and non-.NET Core projects, right?
I'm not sure that class library projects support the Razor tooling.
The code and internal work item tracking for the .NET core implementation for Razor is in the repo. The best place to report issues with Visual Studio is https://developercommunity.visualstudio.com/spaces/8/index.html