Spam
Spam

Reputation: 179

ASP.CORE add custom folder to publication

In my ASP.NETCore application in root I have some custome folder which a copie paste to publish folder after each publication

So my publication folder looks like this:

enter image description here

In MVC5 it was publishing automaticaly by configurations of application properties

enter image description here

UPDATED

I moved my folder inside wwwroot folder so now VS includes it to publication , but now it's possible reach the files inside by typing in browser url: https://domain/customefolder/secret.xml

So now I have 2 questions:

  1. Is it possible to close access to some folder in wwwroot? If no then question two
  2. How to include some custom folder to be published ?

Upvotes: 2

Views: 2565

Answers (1)

Chris Pratt
Chris Pratt

Reputation: 239220

There's no way I'm aware of to add a folder in general to be copied to output via the GUI in Visual Studio, only individual files. However, you can edit your .csproj file and add it there:

<ItemGroup>
    <Folder Include="MyFolder\" />
</ItemGroup>

Or, you may want to use Content with a glob:

<ItemGroup>
    <Content Include="MyFolder\**\*" />
</ItemGroup>

Upvotes: 2

Related Questions