Razor intellisense in plugin project

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
9 years ago
Quantis001 wrote:
Hi,
For me this does not work. I get generic intellisense on int, string etc. But my models do not have it.
J.


Have you tried to build into the bin directory? That is a known VS deficiency with intellisense picking up project references. Steps:
1. go to your project's properties
2. change the output path for all configurations from ..\..\Presentation\Nop.Web\Plugins\<plugin> to bin\
3. build the project
4. restart Visual Studio
5. At this point, intellisense should pick it up, and you can change your output path back to the Plugins directory and your intellisense should be preserved.

I occasionally need to re-do this again after a machine reboot or some other act that causes the intellisense to disappear again.
9 years ago
Found one more very important piece that I noticed when moving from 3.30 to 3.40.  The view file's referenced .dll's must be in the /bin directory of the Plugin for intellisense to work!  So if you have all your references as Copy Local = false, it wont work.  I just fixed that issue by copying all the DLL's I needed from Nop.Admin or Nop.Web's /bin directory, and intellisense works again!
9 years ago
Anyone make any progress on this issue?

Like others, suddenly, all intellisense in all plugins stopped working.  I even went and just tried to download the latest 3.5 changeset from this this morning to see if it was something that I did accidentally to my 3.4 project.  And in that...same issue, all razor views in the plugins have all the same syntax errors as none of the references seem to be wired up to enable intellisense.
So, this for sure means I am dealing with a global Visual Studio issue unrelated to any version of nop.
I am running VS 2013 update 1... I will try update 3 as I need to try something as a next step.  Copying to the bin and manipulating the project file for a specific plugin have been unsuccessful. But not surprised by that. As all plugins are affected, whatever this anomaly is it has to be fixed at a solution level...a solution that fixes 1 specific plugin doesn't seem like it would be what I am looking for.

Most of the errors I get in the view are very misleading. Stuff like
Feature 'lambda expression' cannot be used because it is not part of the ISO-2 C# language specification, etc.

Thoughts?
9 years ago
I should add... changing the output path to bin and clean/rebuilding that others have mentioned in this post and here does get intellisense working for a project, but it does not solve the underpinning error.  For example with the fix described in the link, if you try to do stuff like @Html.EditorFor you get errors like

Error  128  The type arguments for method 'System.Web.Mvc.Html.EditorExtensions.EditorFor<TModel,TValue>(System.Web.Mvc.HtmlHelper<TModel>, System.Linq.Expressions.Expression<System.Func<TModel,TValue>>, string)' cannot be inferred from the usage. Try specifying the type arguments explicitly.  e:\Development\nopCommerce\Plugins\Nop.Plugin.Widgets.myPlugin\Views\myPlugin\_myCreateOrUpdate.cshtml 214 6  Nop.Plugin.Widgets.myPlugin

Of course, if I close the view, build the entire project, the plugin and everything else complies with no errors an works perfect.
9 years ago
Just to give a quick update on this;

After installing VS 2013 update 3, no change.
If you find your situation is like mine where even after intellisense is working from other suggestions in this thread, and you are still getting errors like above ("ISO-2 C# language ..."); There was another thread here that suggested to delete the app.config files in the plugins folder.  (note it also suggests to unload, and edit the project guid...this seemed to have no affect for me).
This did the trick for me... basically, if an app.config file exists, visual studio throws a fit.  I picked a random "out of box" plugins like the facebook shop. Opened one of the razor views, got the error, deleted the app.config file, unloaded the project, then reloaded it...and everything was good for that plugin.
The other suggestions around adding projecttype guids probably did work for others in mvc 4...and even mvc 3, but just didn't work for mvc 5(at least for me)
Anyway, hopefully this helps someone who has this annoying problem in the future.

I still don't understand why all plugins were affected and why I have to do all of this.  The only thing I recall doing that was "out of the ordinary" was just before this all went bad, I disabled Telerik Just Code.  It was spiking my cpu, so I disabled it within Visual Studio.  I think this could have been the trigger that destabilized my VS 2013 settings (not 100% sure).  I happened to check the file "CurrentSettings" for VS 2013...usually found in a folder like C:\Users\Administrator\Documents\Visual Studio 2013\Settings and it was definitely updated after I disabled JustCode.  Unfortunately, my previous system backup is to far back so I can't view the file just prior to all this suddenly happening.
9 years ago
For me intellisense still does not work by deleting the app.config. I had posted this to Microsoft and finally the MS team did not want to resolve this issue.
9 years ago
I have a solution. Intelisence work with Resharper https://www.jetbrains.com/resharper/
9 years ago
There is a blog post here that walks you through the problem and the solution:

http://www.alexwolfthoughts.com/fixing-broken-nopcommerce-razor-intellisense
9 years ago
Thank you, i made it.
9 years ago
http://alexwolfthoughts.com/fixing-broken-nopcommerce-razor-intellisense
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.