Closed kakins closed 5 years ago
Hmm, strange. I'm not able to reproduce this. @rynowak Any ideas?
I don't have any off the cuff ideas. Can you confirm that other blazor features work in the editor? @layout
for instance. Can you confirm the version of the blazor extension in the About...
dialog
One other thing to check. Did package restore complete successfully for the project?
@rynowak Yes I can verify that the extension is installed, which mirrors your screenshot. The features work, I get intellisense, @inject
works, etc. Packages have restored several times as I've been working with the project.
Can you please report back about @layout
? @inject
works the same way in MVC as it does in Blazor. I'm curious if the editor thinks this file is in an MVC project.
I created the project from the Blazor VS template, and opened _ViewImports.cshtml
. I see no syntax errors. I also retyped the @layout
line and it still appears to be working fine.
By the way, just in case, here is my .csproj
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RunCommand>dotnet</RunCommand>
<RunArguments>blazor serve</RunArguments>
<LangVersion>7.3</LangVersion>
</PropertyGroup>
<ItemGroup>
<BlazorLinkerDescriptor Include="linker.xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Blazor.Browser" Version="0.6.0" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="0.6.0" PrivateAssets="all" />
<DotNetCliToolReference Include="Microsoft.AspNetCore.Blazor.Cli" Version="0.6.0" />
</ItemGroup>
</Project>
Also, here is the linker.xml I'm using
<linker>
<assembly fullname="mscorlib">
<!-- Preserve all methods on WasmRuntime, because these are called by JS-side code
to implement timers. Fixes https://github.com/aspnet/Blazor/issues/239 -->
<type fullname="System.Threading.WasmRuntime" />
</assembly>
<assembly fullname="System.Core">
<!-- This is required by JSon.NET and any expression.Compile caller -->
<type fullname="System.Linq.Expressions*" />
</assembly>
<!-- Name of the entry point assembly -->
<assembly fullname="BlazorTest" />
</linker>
@kakins Can you share the project with us?
I went ahead and zipped everything, hope it helps.
I'm having the same problem. All other directives are working (@page, @inherits, etc). I've tried creating from various templates just to isolate: a Razor View, Razor Page, Razor Layout. My VS2017 is version 15.9.0 Preview 4.
In my case though, it turns out this is an issue only when I have ReSharper (v2018.2.3) active. If I disable ReSharper, it works properly.
@kakins Unfortunately I'm still not able to reproduce this, even with your project:
Perhaps the issue is specific to your environment? Maybe try uninstalling resharper?
I had the same issue and was able to resolve it by uninstalling Blazor language services through the VS installer and reinstalling it in Extensions and Updates.
@alexDevBR, I'm interested to know if your working setup included a ReSharper. Does it?
@nolisj no, I don't have ReSharper. I also upgraded to 15.9.1, maybe that also helped, but what solved it was reinstalling Blazor language services. I reinstalled it after the upgrade, but maybe reinstalling it before would have solved the problem too.
Sorry I haven't responded in some time. I haven't had time to play around with Blazor much.
So as a response to @nolisj, I also tried suspending Resharper again. And to my surprise the error went away. I thought I had tried this before, but who knows. Looks to be a ReSharper thing on my end.
@kakins , that's interesting. It seems then that Resharper is causing this issue in our cases.
Just for the other dummies that are searching for this issue like me, you can also get this to happen when your "Build Action" is set to None rather than Content. doh!
I have Blazor 0.6.0 installed, using the VS template. .NET Core SDK 2.1.402. I see this, both with ReSharper enabled and disabled.
The app appears to still compile and run correctly, so perhaps this is an issue with Visual Studio? I have VS 2017 15.8.6.