This project is read-only.

How to enable Intellisense in plugin views

To get Intellisense within plugin views up and running you have to switch your project configuration to PluginDev before editing any view file. This configuration ensures that all required dependencies for Razor dynamic compilation get copied into the correct folder (subdirectory bin\ of the plugin project).

If you want to enable Intellisense for your own plugin project, you have to add two little code snippets to the csproj project file manually. Just ensure that the project is not loaded in Visual Studio and open the file in a text editor.

Add following snippet to the bottom, right before the closing Project tag:
<Import Project="$(SolutionDir)\FixRazorIntellisense.targets" Condition="'$(Configuration)' == 'PluginDev'" />

This specified build file only gets imported when the current configuration is PluginDev. It is then responsible for copying all references, regardless of the CopyLocal attribute value.

Another very useful snippet ensures that CopyLocal always defaults to false:

Place this to the top, right after the opening Project tag.

A bit background info: Visual Studio's default for CopyLocal is true, which means that nearly all references get copied to the output directory. This can dramatically slow down the build process. Furthermore: the output directory for plugins is usually {build}/Plugins/{ThePlugin}. When the app starts, the dll files within this directory get shadow copied over to a shared bin directory, which already contains most of the referenced files (like the very common Autofac for instance). To prevent this redundancy and disk space waste, you simply suppress this behaviour by defaulting CopyLocal to false.

You could also set this attribute manually of course in the properties window of Visual Studio, but with the next NuGet package update your setting would be resetted. So the better approach is to keep references private by default and only set CopyLocal to true explicitly, when the reference is really private (means no other project in the solution references it).

Last edited Apr 15, 2014 at 11:08 PM by muratcakir, version 1