-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Find ASP.NET Core 2 Razor Pages in another assembly #6934
Comments
Where's the type |
located in
|
Does |
Some notes from my investigation: I tried adding a compile reference \ runtime reference to an assembly not referenced by the application i.e. wire up things so you could point to an arbitrary project on disk + associated views. I started with Setting Once you get past this, you start running in to issues where the load context in which we load and reflect over the generated \ compiled Razor type isn't the same as the load context of the AssemblyPart assembly. I tried using Speaking to @sebastienros, it looks like Orchard switched from attempting to load arbitrary assemblies to actual references. I'm not entirely sure if this scenario works E2E very well. |
@soheilalizade feel free to reopen once you have a sample repro. |
@pranavkm I have very same problem. i've created a repo on github |
also created a gist for error: |
Reopening this since we have some information |
I am hitting something similar when trying to self-host ASP.NET Core - with views/controllers in a separate assembly. Full repro available here https://github.com/acinep/Repro/tree/master/Mvc_6934 |
@acinep your repro works fine for me i.e. I can see it print "Hello from embedded view" I clone and run. Can you try doing a clean build? |
@molaie you are copying deps files along with your module binaries to the output directory. Deps files are looked up next to an assembly, but assemblies listed by it for purposes such as compilation are always resolved (a) the application's bin directory (b) the shared runtime (c) the runtime store. Consequently having the deps file in the modules directory prevents these assemblies from being resolved. Removing the deps file solves this immediate issue, but you're still going to run in to issues where you would have to manually resolve the transitive dependency graph of module dependencies as compilation references. I really wouldn't recommend going down this road. In general, instead of rolling your module system, we recommend something more robust like the one Orchard Core provides. Orchard Core modules allow you to build modules as NuGet packages that can be added to your application on the fly. And you can use them as a low level framework without adopting the entire Orchard CMS infrastructure. Check out https://github.com/OrchardCMS/OrchardCore.Samples to see what this looks like. @acinep if you're still seeing issues, feel free to open a new issue. I'm closing this since there isn't any action item for us to do. |
Hi, I want to locate My Project Razor Pages in another assembly.
for doing this I write following code:
my solution:
when running
localhost:5000/SameTodo
Get Followig Error:stack:
and set
PreserveCompilationContext
to false but now worked how can I solve this problem?also, ask this in StackOverflow
The text was updated successfully, but these errors were encountered: