Rob White
Rob White

Reputation: 1002

Visual Studio Publishing Excluding Folders

Inside the publish profile (pubxml) created by VS you can add an exclude tag like the following:

<ExcludeFoldersFromDeployment>Themes;Core;Media</ExcludeFoldersFromDeployment>

Obviously this excludes these folders from being published. I would like to use a wildcard if possible to exclude folders that start with certain text. So Imagine I have a Modules folder that contains dozens of folders some starting test. I want to exclude these folders from being published. I was expecting to use a syntax like:

<ExcludeFoldersFromDeployment>Themes;Core;Media;Modules\Test*</ExcludeFoldersFromDeployment>

but by the fact I'm asking this question you know it doesn't work. Does anyone have any ideas?

Cheers

Upvotes: 4

Views: 2233

Answers (1)

Rob Johnston
Rob Johnston

Reputation: 879

You can use MS Build wildcards to specify what to exclude.

If something like this doesn't work:

<ExcludeFoldersFromDeployment>Themes;Core;Media;Modules\Test\**</ExcludeFoldersFromDeployment>

Then find a way to exlude all the files... maybe like so:

<ExcludeFilesFromDeployment>Modules\Test\**\*.*</ExcludeFilesFromDeployment>

EDIT: Here's a link that may help: "MSBuild Items", https://msdn.microsoft.com/en-us/library/ms171453.aspx#BKMK_Wildcards

Upvotes: 3

Related Questions