Try our conversational search powered by Generative AI!

Are you missing reference when running block view created as on addon



this is driving me crazy. I've been developing quite simple add-on that contain one block. I've setup the environment as described here: so I have my add-on project home under Alloy sample site "modules" folder. I'm also copying the addon dll to "modulesbin" of Alloy site on every build. All this was working nicely for a while, block type was visible on alloy edit view and view for the block was rendered nicely. But now suddenly, I started getting " CS0246: The type or namespace name 'MyAddOnNameSpace' could not be found (are you missing a using directive or an assembly reference?)" from the block view .cshtml compilation. The controller from the same assembly is executed nicely (set some breakpoints) but when compiling the view I get this error.

I really cannot understand why. My dll is in modulesbin, i have  <scanAssembly forceBinFolderScan="true" probingPath="modulesbin" /> episerverframework.config of Alloy site and so forth.

Any ideas what could cause this?

Sep 06, 2013 7:48

And one additional note: I can get my add-on to work as it should if I copy my add-on dll to bin folder of Alloy. So somehow this is related to assembly scanning or something like that. But as I have not dived deep into to inner workings of .net / EPiServer assembly/reference scannning, I'm soooooooo puzzled with this. 

Note 2: Probably I could get this working just by creating everything again from scratch, but then I would not learn anything, I really would like to understand what is happening here.

Sep 06, 2013 8:50
Sep 06, 2013 8:58

Personally, I'd first strip out that AddOn (remove folders, all copies of the bin, edit the packages config), rebuild (ie clean solution) and make sure the site runs fine. Then put it back in and try again.

It's a weird problem so I suspect you've got some kind of conflict or similar... maybe an old copy of that assembly that's gotten copied somewhere?

Also check to see if it works as a proper AddOn as well, without using the project-based deployment technique.



Sep 06, 2013 13:43

Hi Janne

Have a look at your view web.config : YOUR_SITE_ROOT\modules\YOUR_MODULE\Views\Web.config

Have a look at the compilation assemblies section (system.web->compilation->assemblies)

you should have here : <add assembly="your_addon_assembly" />

if you don't have it you will get that CS0246 error, so if it was missing then add it.

This is just a wild quess what is happening, another option might be that you have changed your addons assembly name and just forgot to change it here.

Hope this helps / is the cause to your error.

Sep 08, 2013 9:31

Damn you Antti, you saved my monday! It was definitely about the missing assembly setting under compilation. I had it there at some point, and just as you said, I changed my addon name, ended up with errors, then recreated the whole shit from scratch again and this time forgot the assembly setting. So stupid and frustrating.  I will kiss you next time we see! :-)

Edited, Sep 09, 2013 10:44

Great that you got it working. If we skip the kiss and you buy me a beer ;-)

Sep 09, 2013 15:21
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.