'How to exclude the App_Data folder from being published in an ASP.NET Core 5
I am trying to publish an ASP.NET Core 5 project using FTP. However, I do not want to publish the App_Data folder.
Using Visual Studio 2017, I opened the .csproj file and added the following
<ItemGroup>
<Content Remove="App_Data" />
</ItemGroup>
<ItemGroup>
<Content Update="App_Data">
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Remove="App_Data" />
</ItemGroup>
I also added
<ExcludeFoldersFromDeployment>App_Data</ExcludeFoldersFromDeployment>
to the .pubxml file.
That did not work.
How can I exclude the App_Data entirely from being published?
Solution 1:[1]
I think the easiest way is to exclude the folder in Visual Studio, like the image below.
After testing, the App_Data folder will not be included when publishing again.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jason |

