Allow copying empty directories with <Content>
See original GitHub issueThis issue has been inspired by dotnet/cli#2911. In short, if I specify something like this:
<ItemGroup>
<Content Include="logs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
MSBuild will throw an error saying that the Copy task does not support copying directories. I can put in a glob, but if there are no files, nothing gets copied out (with a glob the why of that behavior is clear to me at least).
/cc @moozzyk
Issue Analytics
- State:
- Created 7 years ago
- Reactions:6
- Comments:14 (3 by maintainers)
Top Results From Across the Web
Allow copying empty directories with <Content> · Issue #1586
MSBuild will throw an error saying that the Copy task does not support copying directories. I can put in a glob, but if...
Read more >Ant Copying Empty Directories
Only files and the top-level directories are being copied. ... You can include copy of empty directories as follows.
Read more >Robocopy /S creates empty folders
There is a simple workaround to quickly remove the empty directories in the destination location which entails running Robocopy <dest> <dest> /S ...
Read more >Copy Files task does not copy empty directories
Copying empty subdirectories can be very important. I found a similar issue about the Publish Artifacts task not copying empty folders: https:// ...
Read more >Copy Folder Structure without Copying Files in Windows
Using the XCOPY command The built-in XCOPY command in Windows can copy the directory or directory tree (i.e., recursively). The switches /T /E ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Ok, so publishing in VS is sorted now, but I’m guessing the
FileSystemPublishtarget doesn’t run when using the clidotnet publish src\myproj.csproj --framework net462 --output "c:\temp" --configuration Releasesince the log folder is not present atc:\temp\logs.So I’ve now got one target for cli/VSCode, and one for VS:
I can go home now 😃
However, I’m guessing the web targets would also need support for folders as items to get that out of the box - so we’re back here.
In the meantime, we can of course hook into file system publish: