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
Excluding folder contents from publish #7861
Comments
Please use
The Web SDK (assuming that's what you are using) is including these files for you already. So you need to update the files' metadata to prevent them from being published. |
Unfortunately that is giving the same behaviour |
@mlorbetske Can you take a look at this? Also, how are you publishing this? CLI, VS? Which version? |
This is in VS 2017 RC, Core 1.1. If I right click a folder and exclude a file from the project, I can see that in .csproj it will have automatically added an itemgroup to remove the file, and that will work. It only seems to be what I am adding that isn't working with regards to changes to .csproj |
Oh, wwwroot\LicenceFiles is a folder? you need to do |
Is that kind of thing covered in the docs anywhere? Ie CopyToPublishDirectory, CopyToOutputDirectory and other options |
@blackdwarf @mairaw for documentation. @ralphking barring additional documentation, is this working for you know? Can we go ahead and close this issue? |
No, it doesn't work. There's not much more information that I can give to debug unfortunately. Is there any documentation for it at all at the moment? Thanks |
Cc @vijayrkn |
@ralphking <ItemGroup>
<Content Update="wwwroot\images\**\*.*" CopyToPublishDirectory="Never" />
</ItemGroup> If you are publishing from VS, please make sure to check this so that if the files are already present, they will be removed as well. |
I updated my previous comment above about which glob to use. I didn't realize that github that processed it to appear different from what I had typed. Also, follow up @vijayrkn instructions above and let us know if that works out for you. |
@ralphking I am closing this issue. If this is still not working for you, please re-activate. |
I was trying to see if the MSBuild reference had those options but it doesn't seem to have all of them: I'll open an issue in their repo for this. /cc @kempb |
I have the same problem and tried with:
But it doesn't work, it's still publishing wwwroot\images and all it's content |
@max-favilli - Can you please share a repro project? If you are publishing from VS, existing files are not deleted by default. You can check the option to 'Delete additional files' in the settings dialog. |
FYI this doesn't work if you want to exclude items from a Razor Class Library. |
I'm also having this problem as well. Any ideas? |
this blog post help me to fix this issue for my publish. |
Thank you for this!
… On May 20, 2020, at 11:07 PM, Alex ***@***.***> wrote:
this blog post help me to fix this issue for my publish.
By Folder1;Folder2
I could exclude some folders
[https://devblogs.microsoft.com/aspnet/web-deployment-excluding-files-and-folders-via-the-web-applications-project-file/]
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#7861 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ABGZGPKJSH2TU7AWPTS242DRSSLI7ANCNFSM4LXWXXIA>.
|
I've tried so many ways to exclude a folder and can't get it to work. Has anyone have documentation on this that is with the recent vs and asp core 3? |
Publishing from Visual studio to IIS server on Windows Server 2012 R2
In .csproj:
Expected behavior
For the contents of this directory not to be published
Actual behavior
The directory contents are being added to the server when publishing
Is there another way in core to stop folders from being published? Specifically, this is a folder that I am writing generated PDF files to. Obviously I don't want to be pushing up any of the files that have been generated in development, so want to retain the folder on the server but just not sync any content.
The text was updated successfully, but these errors were encountered: