1
votes

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

https://docs.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> 
1

1 Answers

0
votes

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.