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

Folder publish should publish empty folders #12475

Open
vijayrkn opened this issue Dec 1, 2017 · 8 comments
Open

Folder publish should publish empty folders #12475

vijayrkn opened this issue Dec 1, 2017 · 8 comments
Labels
Area-WebSDK good first issue Issues that would be a good fit for someone new to the repository. Narrow in scope, well-defined. help wanted Issues that we would accept external contributions on. Also known as up-for-grabs.

Comments

@vijayrkn
Copy link
Contributor

vijayrkn commented Dec 1, 2017

Currently folder publish only publishes folders with files in them.

expected:
Folder publish should publish empty folders as well.

@guardrex
Copy link
Contributor

guardrex commented Dec 1, 2017

Related: https://github.com/dotnet/cli/issues/1396 [but it's soooo old (project.json) that it's only barely relevant]

@dasMulli linked issue is a better xref: aspnet/AspNetCoreModule#30

@GuerrillaCoder
Copy link

Any update on this issue?

@guardrex
Copy link
Contributor

guardrex commented Sep 7, 2018

Looks like it's still "up for grabs."

I'm still doing this ...

<Target Name="CreateLogsFolder" AfterTargets="Publish">
  <MakeDir Directories="$(PublishDir)Logs" 
           Condition="!Exists('$(PublishDir)Logs')" />
  <WriteLinesToFile File="$(PublishDir)Logs\.log" 
                    Lines="Generated file" 
                    Overwrite="True" 
                    Condition="!Exists('$(PublishDir)Logs\.log')" />
</Target>

... not so good, but it works.

@dasMulli
Copy link
Contributor

dasMulli commented Sep 7, 2018

NuGet and others use marker files (foo\_._) to make sure a folder doesn't get deleted.
having empty folders also doesn't work if you're using git version control or similar anyway so it's even hard to have a project with an empty folder.

VS actually uses a Folder item in project files to make sure that the project system will show a folder-based node even if the folder doesn't exist - like for wwwroot.
Publish tasks could make use of that item and create it on publish, e.g. if the folder has some metadata or just by default. Then you could add a <Folder Include="Logs" /> even if there's no folder on disk. You also won't be able to use wildcards here (Include="L*")

@alexandis
Copy link

Looks like it's still "up for grabs."

I'm still doing this ...

<Target Name="CreateLogsFolder" AfterTargets="Publish">
  <MakeDir Directories="$(PublishDir)Logs" 
           Condition="!Exists('$(PublishDir)Logs')" />
  <WriteLinesToFile File="$(PublishDir)Logs\.log" 
                    Lines="Generated file" 
                    Overwrite="True" 
                    Condition="!Exists('$(PublishDir)Logs\.log')" />
</Target>

... not so good, but it works.

For me, it does not work. I am publishing web applications under Default Web Site. And this command does not create any folders.

@vijayrkn vijayrkn transferred this issue from dotnet/websdk Jul 15, 2020
@vijayrkn vijayrkn added Area-WebSDK good first issue Issues that would be a good fit for someone new to the repository. Narrow in scope, well-defined. up-for-grabs labels Jul 15, 2020
@Jalalx
Copy link
Contributor

Jalalx commented Oct 12, 2020

Does it need to have an option like --include-empty-folders?

@mrlife
Copy link

mrlife commented Jun 4, 2021

Would this be a good way to indicate to create an empty folder on publish if it doesn't exist?

<ItemGroup>
    <Folder Include="wwwroot\images\" />
</ItemGroup>

@baronfel baronfel added help wanted Issues that we would accept external contributions on. Also known as up-for-grabs. and removed up-for-grabs labels Aug 19, 2022
@StrajnarFilip
Copy link

Is this issue supposed to be fixed in SDK, or msbuild?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-WebSDK good first issue Issues that would be a good fit for someone new to the repository. Narrow in scope, well-defined. help wanted Issues that we would accept external contributions on. Also known as up-for-grabs.
Projects
None yet
Development

No branches or pull requests

10 participants