Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tito 314 posts 623 karma points
    Jul 06, 2022 @ 16:40
    Tito
    0

    Deploy umbraco v9 / 10 App_Plugins folder

    When i work on my local umbraco App_Plugins folder is in the web root folder. But when i deploy to my hosting it seems to search for it in the wwwroot folder. How should i deploy this folder? i cant see any comment about this in the documentation. Deploy process creates this folder at the root of the site but afterwards shouldnt it be move to the wwwroot folder for it to work? If yes, how can it be done?

  • Andrey Karandashov 23 posts 215 karma points c-trib
    Jul 06, 2022 @ 16:52
    Andrey Karandashov
    0

    I assume that if you will look into "Properties" for each App_Plugins file, it will be marked as "don't copy". It means that the files won't be copied to the release artifact. You have to mark all files as copy "Always" or find a way how copy the whole folder after the build. I can't send the example how to that now, but I think it's easy to find in google :)

  • Tito 314 posts 623 karma points
    Jul 06, 2022 @ 17:35
    Tito
    0

    Hi Andrey, thanks for your answer. They get copied, thats not the problem. The problem is that the path of the folder in my local development is different to the path in the deployed site.

    When i work in my local project, i have AppPlugins folder outside my wwwroot folder (i placed it fist but it didnt work), so i put it in the root project folder. It works. Then, after deploy, it gets copied to the root web project in the hosting site (like in my local dev) but umbraco cant find my Appplugins folder until i move it to the wwwroot folder (inside root folder).

    I would like to know: 1) where to put app_plugins folder while in local dev, in root or in wwwroot? 2) if it must be in root how to move it to wwwroot after deploy?

    BTW i host the application as an Azure web app and i use Devops automatic deployment from the repository.

  • David Peck 690 posts 1896 karma points c-trib
    Aug 12, 2022 @ 15:12
    David Peck
    0

    Did you ever conclude what the answer is?

    Nuget appears to put the some stuff in to either/both folders. I'm confused.

  • Kevin Jump 2342 posts 14889 karma points MVP 8x c-trib
    Aug 13, 2022 @ 05:42
    Kevin Jump
    4

    Hi,

    During development there are a number of FileProviders running on an Umbraco site that take files from different locations and make them look as if they are coming from http://yoursite/app_plugins.

    These file providers mean the files don't actually have to live in the wwwroot folder but to the website they still look like they do.

    It means if you want to access files in App_Plugins via javascript you can use https://yoursite/App_Plugins but if you want to access them via c# you should use the sites WebRootFileProvider (via IWebHostEnvironment) This will munge all the locations together so it looks like the files exist in one /App_Plugins folder on the site.

    App_Plugins locations

    As far as i am aware there are three four different locations that the App_Plugins files can be located and at runtime they are all merged.

    During development:

    • project/App_Plugins
    • project/wwwroot/App_Plugins
    • nuget-cache/package/.../wwwroot/
    • solution/localproject/wwwroot/

    These locations are served by three providers :

    • /App_Plugins is Umbraco's provider*
    • wwwroot/App_Plugins are physical files in the App_Plugins` location that is directly served by the server
    • nuget_chache/package/../wwwroot/ is the is pulling files in from Razor Class Library projects to make them appear on the site.
    • Files from a local Razor Class Library in your project will work like the files in the NuGet cache

    Live Site

    When you make a site live (via dotnet publish, The files from the nuget cache are physically copied into the wwwroot/App_Plugins folder of the site and the static assets file provider doesn't run.

    • sitefolder/App_Plugins
    • sitefolder/wwwroot/App_Plugins

    So ?

    • These means the package files aren't really in one location, but if you need them to appear as if they are in code you need to use the FileProvider.

    • if you are working locally with files - you want to put them in /App_Plugins or you can put your files in a separate razor class library in your project and have them be served from there as your develop.

    • Packages that put files in myproject/App_Plugins will do this via a build step, you should avoid manually changing these files in your project because if you run a 'dotnet build' those changes could be overwritten.

    phew.

  • Tito 314 posts 623 karma points
    Aug 16, 2022 @ 08:06
    Tito
    0

    Thanks for your response Kevin. In my local dev environment i use: project/App_Plugins

    It works, but when publishing it is not copied to wwwroot. I use Devops build pipelines do i have to set some configuration? In my project file i have this item group:

    <ItemGroup>
    <Content Include="App_Plugins\NextJsWelcomeDashboard\control.html" />
    <Content Include="App_Plugins\NextJsWelcomeDashboard\estilos.css" />
    <Content Include="App_Plugins\NextJsWelcomeDashboard\lang\en-US.xml" />
    <Content Include="App_Plugins\NextJsWelcomeDashboard\lang\es.xml" />
    

    And this one:

    <ItemGroup>
    <None Include="App_Plugins\NextJsWelcomeDashboard\controller.js" />
    <None Include="App_Plugins\NextJsWelcomeDashboard\package.manifest" />
    

    The are created automatically when creating the plugin.

  • David Peck 690 posts 1896 karma points c-trib
    Aug 16, 2022 @ 08:39
    David Peck
    0

    There are answers, and then there are great answers!!!

  • David Peck 690 posts 1896 karma points c-trib
    Aug 16, 2022 @ 08:43
    David Peck
    0

    Can I suggest you change those to:

    <ItemGroup>
        <Folder Include="App_Plugins\**" />
    </ItemGroup>
    

    That will include everything in your App_Plugins without having to reference individual files. It should also include the files when you publish. The files will get published at ~/App_Plugins/** as per your local filesystem but as Kevin says they will be available via the /App_Plugins path just as if they were in ~/wwwroot/App_Plugins

  • Tito 314 posts 623 karma points
    Aug 16, 2022 @ 10:20
    Tito
    0

    Thanks David,

    I have several questions:

    I have changed that item group and removed the "None Include" lines, what do they do?

    So after publishing using Azure devops pipeline, the App_Plugins its published as before, but it its not copied to wwwroot folder so it does not work as i have understood that the FileSystem providers only work in local dev environment.

    I can copy the folder via FTP to wwwroot folder, and then it works. But even then i still have a cache issue when modifing the controller js. How should i configure RuntimeMinification in my production site? i have this in appSettings.json:

    "RuntimeMinification": { "CacheBuster": "Version", "Version": "1" }

    Is that correct for production? should i increment the version and restart the app to bust the cache?

  • Jeroen Oostwouder 100 posts 296 karma points
    Feb 10, 2023 @ 11:27
    Jeroen Oostwouder
    0

    That makes sense. Today I learned... :)

    One question. Is there a certain order to the different locations?

    For example: I install a package which has a view in it's internal app_plugins (nuget_cache/package/mypackage/wwwroot or something).

    Can I override that view locally by creating the same folders/files withing /app_plugins ?

  • David Peck 690 posts 1896 karma points c-trib
    Aug 16, 2022 @ 12:05
    David Peck
    0

    Hi Tito.

    Your original <ItemGroup /> nodes references files to be included in the project (although files are by default anyway). The <Content /> ones explicitly specified that the files should be included a publish and the <None /> specified that they should not be included. My <Folder /> suggestion just states that everything in the App_Plugins folders was content to avoid bloating the csproj.

    The files should work when they are at the root of the site even on the server. They shouldn't need to be in the wwwroot folder, if Kevin is right (and he always is).

    If the change the version number ("1" -> "2") then that should stop the previous version of your file being server. Or you might find deleting the files at /umbraco/Data/TEMP works.

  • Tito 314 posts 623 karma points
    Aug 16, 2022 @ 14:26
    Tito
    0

    Hi David,

    I misundertood Kevin when he wrote:

    During development there are a number of FileProviders running on an Umbraco site that take files from different locations and make them look as if they are coming from http://yoursite/app_plugins.

    I understood FileProviders only worked when in dev mode.

    I have removed your

    <Folder Include="App_Plugins\**" />
    

    because with that setting my VS Studio does not let me edit the files, it shows them as folders. Im trying to upload here a screenshot but our.umbraco.com errors. You can view it here: https://drive.google.com/file/d/1nffvPTzXlnDTVf_V75LN3yHSXcHFVmeh/view

    So i let this configuration in my csproj which is the automatic generated when creating the folder:

         <ItemGroup>
        <Content Include="App_Plugins\Inscripciones\control.html" />
        <Content Include="App_Plugins\NextJsWelcomeDashboard\control.html" />
        <Content Include="App_Plugins\NextJsWelcomeDashboard\estilos.css" />
        <Content Include="App_Plugins\NextJsWelcomeDashboard\lang\en-US.xml" />
        <Content Include="App_Plugins\NextJsWelcomeDashboard\lang\es.xml" />  
    </ItemGroup>
        <ItemGroup>
            <None Include="App_Plugins\Inscripciones\controlador.js" />
            <None Include="App_Plugins\Inscripciones\package.manifest" />
            <None Include="App_Plugins\NextJsWelcomeDashboard\controller.js" />
            <None Include="App_Plugins\NextJsWelcomeDashboard\package.manifest" />
          </ItemGroup>
    

    It seems a cache problem, i have deleted App_Plugins from wwwroot folder in remote server and from root project folder, same with /umbraco/Data/Temp files. Increase version and publish the website.

    But it only published the js and manifest files (the ones with the "None" itemgrup), so i have uploaded using ftp the rest of files (html, css and langs) and now it works.

    So what do i have to change in my csproj to publish all my files in app_plugins folder? as said your previous conf setting did not work as my visual studio is confused.

  • Tito 314 posts 623 karma points
    Aug 16, 2022 @ 15:33
    Tito
    0

    I have changed to this:

    <ItemGroup>
        <Content Include="App_Plugins\**" />
    </ItemGroup>
    

    And now i can view and edit in VS Studio. But when publishing the are not copied to project root.

    I have added this:

     <ItemGroup>
        <None Include="App_Plugins\**" />
      </ItemGroup>
    

    But still dont get copied to publish root. I only need App_Plugins to be copied as it is.

  • Fredrik Stolpe 10 posts 103 karma points
    May 24, 2023 @ 11:00
    Fredrik Stolpe
    0

    Changing "Do not copy" to "Copy always" for the plugin files did the trick for me. They end up in the App_Plugins in the project root directory and Umbraco finds them there.

  • Biagio Paruolo 1618 posts 1910 karma points c-trib
    Apr 05, 2024 @ 13:05
    Biagio Paruolo
    0

    So.Do I copy under wwwroot or not?

  • Huw Reddick 1929 posts 6697 karma points MVP 2x c-trib
    Apr 05, 2024 @ 13:49
    Huw Reddick
    0

    As I said in the thread you created, it should not matter, it should look in both

    \App_Plugins

    and

    \wwwroot\App_Plugins

Please Sign in or register to post replies

Write your reply to:

Draft