Developer forum

Forum » Templates » Is there a "smart" way to find missing references in Visual Studio?

Is there a "smart" way to find missing references in Visual Studio?

Bjørn Kamfjord
Reply

I'm trying to copy a template file from another solution to my project, but it is missing some references or assemblies.

Is there a "smart" way to find the missing references in Visual Studio?

 

What I'm doing is copying some template files from Rapido 2.0. the newsletter.cshtml, to my own project. I have also copied over EmailMaster and EmailHelpers, + the newslettere/paragraph/* folder and files. 

But when I build or try to use the template files, it is missing assemblies or references. I see that in the newslettter.cshtml it includes helpers and master, but intellisense is not catching the references to the helpers and classes?

Is there some helpers, references or NuGet packages I need to add?

 

 

 

 

 

 

missing_helpers.png namespace_missing.png

Replies

 
Bjørn Kamfjord
Reply

And this is the error I get in frontend when I try to use the template...

Exception in template (Designs/EG/_parsed/newsletter.parsed.cshtml): System.NullReferenceException: Objektreferanse er ikke satt til en objektforekomst. 
ved CompiledRazorTemplates.Dynamic.cecefaafcafbabe.b__1(TextWriter __razor_helper_writer) ved RazorEngine.Templating.TemplateWriter.WriteTo(TextWriter writer) 
ved RazorEngine.Templating.TemplateBase.Write(TemplateWriter helper) ved CompiledRazorTemplates.Dynamic.cecefaafcafbabe.Execute() 
ved RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context) 
ved RazorEngine.Templating.TemplateService.Run(ITemplate template, DynamicViewBag viewBag) 
ved RazorEngine.Templating.TemplateService.Parse(String razorTemplate, Object model, DynamicViewBag viewBag, String cacheName) 
ved RazorEngine.Razor.Parse[T](String razorTemplate, T model, String cacheName) 
ved Dynamicweb.Rendering.Template.RenderRazorTemplate()
 
Nicolai Pedersen
Reply

Hi Bjørn

When using includes and master files in Dynamicweb templates, will not gice you VS intellisense - and they cshtml templates cannot be build. So you have to ignore the warnings related to that.

The reason you get the exception is that you are using the newslettermaster which has some references from Rapido - rapido have a website item settings which are referenced. So you need to remove thouse dependencies from your master template. See dump for some of them.

Capture.PNG

 

You must be logged in to post in the forum