[Mono-list] mvc view does does not use assembly reference when assembly is exe.

Daniel Lo Nigro lists at dan.cx
Sun Sep 23 23:09:45 UTC 2012


It looks like ASP.NET doesn't like EXE references, as it seems the same
issue happens on Windows:
http://stackoverflow.com/questions/3132150/how-to-add-exe-as-reference-in-my-web-application

http://www.pcreview.co.uk/forums/re-cannot-reference-exe-t4006582.html

I'm guessing the ASP.NET compiler doesn't handle EXE references the same
way as DLL references. All view files are compiled at runtime using the
ASP.NET compiler, which may compile the files with different build
parameers compared to the rest of the app. The shared code should probably
be in a .DLL assembly - I can't think of any reason why a website should
reference an EXE file and not a DLL file.

You could try precompiling your views and seeing if that changes anything
(set MvcBuildViews to true in your .csproj file). This compiles the views
when you compile the rest of your application and it might fix this issue.
This is an option in ASP.NET MVC 3 and 4 but I'm not sure if it's available
in ASP.NET MVC 2. I'd suggest just moving the shared classes into a class
library (DLL) file though.

On Mon, Sep 24, 2012 at 3:10 AM, John Cole <johnwebbcole at gmail.com> wrote:

> I have a mvc2 project that references an assembly that is an EXE.  The
> controllers see the project just fine and can reference all of the
> assembly's classes.  However the view does not have the assembly
> referenced.  Looking at the compiler command line for the view error, there
> is no /r: line for the linked exe assembly.
>
> Not sure why views don't link in exe assembly's.  Any suggestions?  In the
> mean time, I can break out the common code into a separate ell assembly.
>
> Thanks,
>
> John
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-list/attachments/20120924/39d2df60/attachment.html>


More information about the Mono-list mailing list