ExcludeFilesFromDeployment not working in Visual Studio 2013 Publishing Web Pages

I have a fairly simple MVC 5 project in Visual Studio 2013. I have successfully configured publishing through Web Deploy to the server. I want to exclude a specific file from deployment without previewing / removing it from the screen each time I publish (I publish the Release build).

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

 <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 disabled to be added when I go to publish to VS2013.

I also tried adding bin\ in front of the library, just in case. Not to mention, a warning appears for an 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'. ... "

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

+5
source share
2 answers

You need to add it to the profileName.pubxml file. Status of profileName.pubxml file:

 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> ''' '''' 
+5
source

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

 <DeleteExistingFiles>False</DeleteExistingFiles> 

Remove all files from your Temp publishing location (usually obj \ Release \ Package \ PackageTmp) after excluding some files or directories.

0
source

Source: https://habr.com/ru/post/1205992/


All Articles