I'm working on a web application where pages need to be populated from other projects. I was hoping to use a Razor Class Library (RCL) for that.
The documentation states that a RCL can be referenced only as a project reference or a nuget package. I was hoping it would just be a shortcut to make sure developers went the recommended way. Unfortunately, if I directly reference the two generated assemblies from my RCL project (MyProject.dll
and MyProject.Views.dll
), it doesn't work. It works only if I add a project reference to the RCL project.
The company I work for has a custom build pipeline, and for reasons outside of my control I can only directly reference assemblies.
I've spent some time comparing the output of the compilation when using direct references and project references, but I couldn't find a difference. Does anybody know why direct references don't work for RCL? If I understand what the difference is, I should be able to work my way from there.
As a bonus, is somebody aware of a workaround? Creating a CompiledRazorAssemblyPart
works (as described in Loading Razor Class Libraries as plugins), but I'd rather not have to manually search for the assemblies.