Broken razor intellisense when creating plugin for 4.1

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
5 years ago
Any ideas how to fix it in 4.1?
5 years ago
I use Visual Studio 2017
5 years ago
_ViewImports.cshtml worked for me. Just copied from payments manual.
5 years ago
Intellisense not working for me nor on default plugins, using VS2017 15.9.4, any idea to solve it or what I'm doing wrong?
5 years ago
Solution, that works for me. Two ways (depends that you already created project or you are creating it now):

1. You are creating project:
Don't create it as ClassLibrary, but select ASP.Net Core Web Application and then Razor Class Library.

2. You already created project using ClassLibrary:
Open .csproj of project and replace <Project Sdk="Microsoft.NET.Sdk"> with <Project Sdk="Microsoft.NET.Sdk.Razor">.

I will show it on Payments.Manual plugin:

Step 1:


Intellisense will start working:


Step 2: But VS shows an error (because different settings for Sdk.Razor):

Duplicate 'Content' items were included. The .NET SDK includes 'Content' items from your project directory by default. You can either remove these items from your project file, or set the 'EnableDefaultContentItems' property to 'false' if you want to explicitly include them in your project file. For more information, see https://aka.ms/sdkimplicititems. The duplicate items were: 'Views\Configure.cshtml'; 'Views\PaymentInfo.cshtml'; 'Views\_ViewImports.cshtml'


How to solve it:


Or just remove <Content Include=".... (cross 1) for all views, save it and then in Solution Explorer set Copy to  Output Directory to Copy if newer for all views and <Content Update="... will be created automaticaly.


Then everything is ok:


I tested it, plugins will load and work correctly.
3 years ago
martinzwierzyna wrote:
Solution, that works for me. Two ways (depends that you already created project or you are creating it now):

1. You are creating project:
Don't create it as ClassLibrary, but select ASP.Net Core Web Application and then Razor Class Library.

2. You already created project using ClassLibrary:
Open .csproj of project and replace <Project Sdk="Microsoft.NET.Sdk"> with <Project Sdk="Microsoft.NET.Sdk.Razor">.

your solution working for me.

thanks for your post

I will show it on Payments.Manual plugin:

Step 1:


Intellisense will start working:


Step 2: But VS shows an error (because different settings for Sdk.Razor):

Duplicate 'Content' items were included. The .NET SDK includes 'Content' items from your project directory by default. You can either remove these items from your project file, or set the 'EnableDefaultContentItems' property to 'false' if you want to explicitly include them in your project file. For more information, see https://aka.ms/sdkimplicititems. The duplicate items were: 'Views\Configure.cshtml'; 'Views\PaymentInfo.cshtml'; 'Views\_ViewImports.cshtml'


How to solve it:


Or just remove <Content Include=".... (cross 1) for all views, save it and then in Solution Explorer set Copy to  Output Directory to Copy if newer for all views and <Content Update="... will be created automaticaly.


Then everything is ok:


I tested it, plugins will load and work correctly.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.