Oppa Gingham Style
Oppa Gingham Style

Reputation: 178

ExcludeFilesFromDeployment not working in Visual Studio 2013 Publish Web

I have a fairly straightforward MVC 5 project in Visual Studio 2013. I have successfully set up publishing via Web Deploy to the server. I want to exclude a certain file from deployment without having to preview/uncheck it every time I publish (I am publishing the Release build).

I have edited the .csproj file for the project to include the <ExcludeFilesFromDeployment> tag.

<Project...>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    ...
    <ExcludeFilesFromDeployment>Library-that-is-not-good-for-server.dll</ExcludeFilesFromDeployment>
  </PropertyGroup>

But nothing changes/the file still needs to be unchecked for addition when I go to publish in VS2013.

I have also tried adding a bin\ in front of the library, just in case. Not to mention, a warning pops up for the element that says "The element 'PropertyGroup' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003' has invalid child element 'ExcludeFilesFromDeployment' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003'. ..."

Microsoft's documentation that I was able to find in searches regarding excluding files from deployment, and the ExcludeFilesFromDeployment tag, http://msdn.microsoft.com/en-us/library/ee942158(v=vs.110).aspx, claim that the instructions only apply to VS2012 and partially to VS2010. Does anyone know what has changed for VS2013 or what I am doing wrong?

Upvotes: 5

Views: 4951

Answers (2)

Seyedi
Seyedi

Reputation: 1

You probably need to have the following definition also in the 'profileName'.pubxml file:

<DeleteExistingFiles>False</DeleteExistingFiles>

Please remove all files from your Temp publish location(normally obj\Release\Package\PackageTmp) after excluding some files or directories.

Upvotes: 0

qakmak
qakmak

Reputation: 1377

You need to add it in the profileName.pubxml file. profileName.pubxml file position is:

my project ----> Properties ----> PublishProfiles ---> profileName.pubxml

Example:

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <ExcludeFilesFromDeployment>
    Library-that-is-not-good-for-server.dll
  </ExcludeFilesFromDeployment>

'''                '''' 

Upvotes: 9

Related Questions