puri
puri

Reputation: 1849

How to ignore files and folders when publishing ASP.NET web app to Azure?

I am using Visual Studio 2015 and the built-in publishing tool outlined here to publish my ASP.NET web app to Azure:

https://learn.microsoft.com/en-us/azure/app-service-web/web-sites-dotnet-get-started

How can I automatically ignore folders like wwwroot/lib, wwwroot/packages?

I have already tried these entries in .pubxml file without success

<PropertyGroup>
  <ExcludeFoldersFromDeployment>
    packages
  </ExcludeFoldersFromDeployment>
</PropertyGroup> 

Upvotes: 1

Views: 1931

Answers (1)

Bruce Chen
Bruce Chen

Reputation: 18465

According to your description, I assumed that you have created an ASP.NET 5 project. If so, you could modify the publishOptions > exclude section within your project.json file as follows:

"publishOptions": {
  "include": [
    "wwwroot",
    "**/*.cshtml",
    "appsettings.json",
    "web.config"
  ],
  "exclude": [
    "wwwroot/lib/**", //exclude all files/folders
    "wwwroot/lib/**/src/**" //exclude the files/folders under "src" folder
  ]
}

Additionally, ASP.NET recommends use Bower to manage client-side resources. And the JavaScript and CSS libraries are stored under wwwroot\lib by default. So, you could change the storage location for bower libraries to achieve your purpose. For more details, you could refer to this tutorial.

Upvotes: 0

Related Questions