Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Umbraco 9.5.1 - VS publish deploy issue #12572

Closed
thomashdk opened this issue Jun 13, 2022 · 15 comments
Closed

Umbraco 9.5.1 - VS publish deploy issue #12572

thomashdk opened this issue Jun 13, 2022 · 15 comments

Comments

@thomashdk
Copy link
Contributor

thomashdk commented Jun 13, 2022

Which exact Umbraco version are you using? For example: 9.0.1 - don't just write v9

9.5.1

Bug summary

After upgrading to 9.5.1, when publish deploy from visual studio the publish skips *.html files from the ./App_Plugins folder.
Works fine in 9.4.3 - Stopped working in 9.5.0

Specifics

Html files in App_Plugins folder are missing after a Folder Publish deploy from Visual Studio

Steps to reproduce

  • Install Umbraco 9.5.1
  • Create a App_Plugins folder
  • Create a plugin folder.
  • Create a html files.

-Publish project to a folder

  • Html file in plugin are missing in the deploy folder

Expected result / actual result

All included files should be copied to deploy folder when included in project.


This item has been added to our backlog AB#25526

@Ambertvu
Copy link
Contributor

Ambertvu commented Jun 13, 2022

I'm having the exact same thing since the upgrade.
Only thing is I'm not publishing from visual studio but from an Azure Pipeline (and it creates a docker container) so couldn't easily check if it was a file capitalization issue or if something went wrong during the publish. But this at least saves time debugging tonight ;-)

I double checked my commits, and the only thing changed is the version number in the .proj files. so not entirely sure why these files aren't published anymore.

Just a minor update: I ran my project using docker, and indeed the .html files were missing in the App_Plugin.

@thomashdk
Copy link
Contributor Author

But this at least saves time debugging tonight ;-)

I spend way to much time finding out what the issue could be.. :P

@Ambertvu
Copy link
Contributor

Ambertvu commented Jun 21, 2022

This also happens in V10.0.0

@Ambertvu
Copy link
Contributor

Ambertvu commented Jun 22, 2022

I've been testing this a bit (cleaned up my .proj so it contained nothing except the default. Re-added my custom Plugin.
It was added like this:

      <Content Include="App_Plugins\Top10picker\top10picker.html"/>
    </ItemGroup>
	<ItemGroup>
		<None Include="App_Plugins\Top10picker\package.manifest" />
		<None Include="App_Plugins\Top10picker\top10picker.controllers.js" />
		<None Include="App_Plugins\Top10picker\top10picker.cshtml" />
	</ItemGroup>

After a republish the .html file was still missing.

Changed the properties for the .html file to Copy Always:

      <Content Include="App_Plugins\Top10picker\top10picker.html">
        <CopyToOutputDirectory>Always</CopyToOutputDirectory>
      </Content>
    </ItemGroup>
	<ItemGroup>
		<None Include="App_Plugins\Top10picker\package.manifest" />
		<None Include="App_Plugins\Top10picker\top10picker.controllers.js" />
		<None Include="App_Plugins\Top10picker\top10picker.cshtml" />
	</ItemGroup>

This fixed it for me as a workaround. But this shouldn't be default behaviour.

I had the exact same issue with /config/grid.editors.config.js, only when specifically saying to Copy Always it in the properties it would be fixed.

@jaandrews
Copy link
Contributor

I'm running into this as well in umbraco 10.3.2. CSS and html files fail to deploy from the "App_Plugins" folder. I have noticed that css files under wwwroot deploy successfully, but umbraco doesn't pick up on the package.manifest if I move the whole app_plugins folder inside wwwroot).

@Ambertvu
Copy link
Contributor

Ambertvu commented Dec 8, 2022

For 10.+ it seems to work to NOT include the app_plugins files in the project. Don't ask why :-)

@Zeegaan
Copy link
Member

Zeegaan commented Dec 28, 2022

Sorry for the late answer! I can definitely reproduce this, and IIRC we've had a problem like this in the past (I think I even tried to fix it) 🤣 Interesting note here is that if my file is directly in the App_Plugins folder it gets published fine:
image
But if its in another folder it does not get published 🤔

@github-actions
Copy link

Hi @thomashdk,

We're writing to let you know that we would love some help with this issue. We feel that this issue is ideal to flag for a community member to work on it. Once flagged here, folk looking for issues to work on will know to look at yours. Of course, please feel free work on this yourself ;-). If there are any changes to this status, we'll be sure to let you know.

For more information about issues and states, have a look at this blog post.

Thanks muchly, from your friendly Umbraco GitHub bot :-)

@eliranrefael
Copy link

Updating that im encountring the same problem, im running umbraco 10.3.2 on container, i do restore and publish, and if im removing App_Plugins folder from source control i wont get it in the publish folder.
for this experiment im using contentment plugin, which renders its assets in app_plugins folder on root during build.
i tried to explicitly adding the folder as an item group with folder tag and content tag with the always copy option with no luck.
hope someone will have a solution for that one!

@jaandrews
Copy link
Contributor

@eliranrefael One way I've used to work around this issue is to move all of the files into a razor class library. This bundles the files into the package dll and so avoids this problem. This is what umbraco forms does now, which is why it's files no longer show under the app_plugins folder. Some guidance on how to work with this can be found here.

This won't help though if the package isn't set up for this though, in which case you will need to tinker with the project files as suggested above. A quick hack that may help would be to replace all references that are under app_plugins with a single

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

This should make the files deploy, but keep in mind that this will prevent any cs files from compiling, as those need a "Compile" tag and not a "Content" tag to compile. Can still be made to work, but it would need to target specific directories/files instead of the whole app_plugins folder, like how it's done in the earlier example.

@lassefredslund lassefredslund added the state/sprint-candidate We're trying to get this in a sprint at HQ in the next few weeks label Jan 11, 2023
@eliranrefael
Copy link

@jaandrews hey,
in this stage i would be satisfied in just including the folder as u suggested. the problem is that the solution you suggested doesnt work. for demonstration, delete the folder from source before publishing. it seems like the folder is created only after publish is ended, like in post build actions.

@jaandrews
Copy link
Contributor

@eliranrefael Did you delete all other references to the files in the app_plugins folder in the project file aside from the catch all reference? Does it work as expected if you run dotnet publish on your local machine? This did copy the files when I did that and was the workaround suggested when I contacted umbraco support about this issue. Could be a problem with your deployment pipeline if that works on your end.

@bergmania
Copy link
Member

bergmania commented Jan 18, 2023

I have spend some time looking into this.

From what I can see, then it works as expected out of box, BUT (!), when I add the files using my IDE (Rider/Visual Studio), then it automatically adds the following to my project file (.csproj)

<ItemGroup>
  <Content Include="App_Plugins\FolderNameFileName.ext" />
</ItemGroup>

This states that the file should not be copied, because it do not set the CopyToPublishDirectory.

If I wanna see all files from App_Plugins in my IDE, I can add this:

<ItemGroup>
  <Content Include="App_Plugins\**">
    <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
  </Content>
</ItemGroup>

Then it works again and all files seems to be copied to my publish folder.

Personally, I do not think it make sense to add this automatically to our templates, as many packages still write content to App_Plugins, instead of using Razor Class Libraries. Files from packages should IMO not be shown in my project overview.

@bergmania
Copy link
Member

I'll close this issue as it works as expected in v10+

I'm sorry you experienced this on a minor update :(

@lassefredslund
Copy link
Contributor

lassefredslund commented Feb 2, 2023

Just FYI, here is my best attempt at an explanation.

Clients sometimes experience that they have a project that works locally, but when pushing it to Cloud (or any other hosting environment) some files go missing from the App_Plugins folder.
This happens because IDEs like Visual Studio and Rider (but not VS Code) try to assist and play intelligent with files that are not added to the wwwroot-folder, but it seems to confuse many developers in this specific case.
In short, there are two ways to avoid this:

  1. Place your App_Plugins folder below the wwwroot folder, as all files will be copied during publishing. If you choose this option, please be sure that you do not have any license files or files that should not be directly accessible through a URL.
  2. Place your App_Plugins folder outside the wwwroot folder and let the IDE know about the specific files you want to copy during publishing. By default the IDE includes files in the project through the project files like this:
    image
    However, to ensure that files are also included when publishing, you need to change Include to Update like this or explicitly specify what files to copy on publish. Please ensure not to include e.g. license files and other files that should not be directly accessible through the URL:
    image

History
The description above is 100% standard Visual Studio/Rider experience, so one might argue that no developers should be surprised about this. However, we need to recall the history here, as it hasn’t always been this way. Up until version 9.4, we actually did some “magic” in the project-file, so that App_Plugins files automatically were included, however, with V9.5 this logic was changed. We still copy over files that are located in App_Plugins folder (even if this folder is located outside the wwwroot folder) but if the files are listed in the project file, we only publish files that are set to “update”.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants