Sébastien Ros - Modular ASP.NET apps

Sign in to queue

Description

This week, Sébastien Ros is back on the show to demo the fantastic support for modularity that was built for Orchard Core, but that is usable in any ASP.NET Core application.

Embed

Download

Download this episode

The Discussion

  • User profile image
    giannik73

    sebastien for president.

  • User profile image
    sumonnet

    Great Work!!!

    is it possible to include typescript files in Modules? and also somehow reference typescript file from one module and inherit from it?

    Thanks, 

  • User profile image
    messan

    Great presentation Sébastien.

    We all know that Orchard the CMS has a very nice story about module discovery but in the scenario where the CMS is not involved, is there a predefined way to let the Web Application automatically discovered the modules without previously referencing them ?

    Thanks

  • User profile image
    sebros

    @sumonnet:

    Yes you can add any static file. You can reference it directly and it will incur a direct dependency with this module. We do that in the CMS packages, where jQuery for instance is provided by a single module even though most of them depend on this script.

    The next level of features is provided by our Orchard.ResourceManagement module which can inject script/css management and manages dependencies from several modules.

  • User profile image
    sebros

    @messan:

    We tried this approach as this is what we do in Orchard 1 but the complexity involved and degraded experience were not worth it. For instance discovering modules would mean that they have to be in a specific folder under the web app. Not talking about dotnet tooling that doesn't work with this like razor precompilation, publish, pack, ... These can all be solved but with some significant amount of custom code and hacks. After implementing both we really do prefer the "referenced" way.

  • User profile image
    Trung

    Hi!

    I created one website use Orchard Core modular. But when I deploy on Azure it isn't working. It allway show error 404. Could you please help me about that!

  • User profile image
    bleroy

    As always, look at your logs.

  • User profile image
    Trung

    @bleroy

    It haven't error. When I request to server, It response status 404. I don't understand why I can run on local, but I deploy on azure it's not working with error 404.

    I thank on azure it not accept routing I config in module.

    Do I need configuration any things so it's working.

    http://space-web.azurewebsites.net

    You can see it.

  • User profile image
    bleroy

    It's impossible to diagnose from so little information. Comments on a video are also not the best for such a discussion. You can ask for help on one of the places http://www.orchardproject.net/discussions links to.

  • User profile image
    Admin James

    This looks clever but what on earth is going on? From the looks of things the modules are moved to a Packages directory within the application. Is this done via a build task? If so then how are the views found?

    Adam

  • User profile image
    Sebastien Ros

    Adam,

    Yes, the static assets like JavaScript, css and razor views have to be copied below the application. It's done using an msbuild tasks that is used as you reference the "marker" packages. An improvement we could make in the future is to use custom file providers, or copy the resources on-demand on the filesystem (like a cache).

  • User profile image
    Adam James

    Thanks Sebastien. I've downloaded the sample app however whenever I make a change to my view in Module1 and do a build it doesn't update the view in the Packages directory. Could you please point me to part which copies the packages so I can debug it. Thank you.

  • User profile image
    jtkech

    Adam,

    It is done through msbuild task in .props / .targets files, paticularly an AfterTargets="Build" is executed when you "really" build the app. Before, when building / starting the app this task was always triggered, even if the app didn't need to be rebuilt. Now this no more the case, so when you only update e.g a razor file you would need to do a Rebuild on your module or your app.

    But while in dev, modules asset files are served fron their project locations through custom file providers. So you don't need to copy them under the Packages folder. You can update assets, put a brekpoint in a razor file ..., this directly in the module project files.

    Then, when you want to copy them under Packages, if you didn't change any other item which is a compilation dependency (e.g a csharp file), you would need to do a Rebuild on your module or a Rebuild on your app. To prevent from having to rebuild many projects, one workaround is to update only one csharp file of the app (e.g startup.cs), then only do a Build on the app or restart it.

    But notice that when publishing, the app is automatically rebuilt, so ...

    Best

  • User profile image
    Babu Annamalai

    If anyone looking for the latest version of the sample using Orchard Modules, refer to https://github.com/OrchardCMS/OrchardCore.Samples

Add Your 2 Cents