I have an ASP.NET Core 2 web application. Whenever I try to deploy the application, Visual studio replaces appsettings.json and Web.config which causes problem to the application. Is there a way to inform Visual Studio that I do not want to deploy these two files?
Asked
Active
Viewed 74 times
0
-
Possible duplicate of [dotnet core publish: include/exclude dir in output](https://stackoverflow.com/questions/43569821/dotnet-core-publish-include-exclude-dir-in-output) – Sawrub Apr 02 '18 at 19:08
1 Answers
1
Add a new ItemGroup section in the .csproj file.
For instance the following block would ensure both variants of appsettings.json are not copied to publish folder.
<ItemGroup>
<Content Update="appsettings.Development.json" CopyToPublishDirectory="Never" />
<Content Update="appsettings.json" CopyToPublishDirectory="Never" />

Sawrub
- 683
- 5
- 16