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?
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 :)
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.
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 threefour 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
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.
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:
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
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:
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.
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.
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.
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.
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?
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 :)
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.
Did you ever conclude what the answer is?
Nuget appears to put the some stuff in to either/both folders. I'm confused.
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 sitesWebRootFileProvider
(viaIWebHostEnvironment
) 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
threefour different locations that the App_Plugins files can be located and at runtime they are all merged.During development:
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 servernuget_chache/package/../wwwroot/
is the is pulling files in from Razor Class Library projects to make them appear on the site.Live Site
When you make a site live (via
dotnet publish
, The files from the nuget cache are physically copied into thewwwroot/App_Plugins
folder of the site and the static assets file provider doesn't run.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.
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:
And this one:
The are created automatically when creating the plugin.
There are answers, and then there are great answers!!!
Can I suggest you change those to:
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
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?
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
?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 theApp_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.Hi David,
I misundertood Kevin when he wrote:
I understood FileProviders only worked when in dev mode.
I have removed your
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:
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.
I have changed to this:
And now i can view and edit in VS Studio. But when publishing the are not copied to project root.
I have added this:
But still dont get copied to publish root. I only need App_Plugins to be copied as it is.
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.
So.Do I copy under wwwroot or not?
As I said in the thread you created, it should not matter, it should look in both
\App_Plugins
and
\wwwroot\App_Plugins
is working on a reply...