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?
On the computer where you have the ASP.NET project open in Visual Studio, right-click the project in Solution Explorer, and choose Publish. If you have previously configured any publishing profiles, the Publish pane appears. Click New or Create new profile. Select the option to import a profile.
Basic command-line publishing The default publish folder format is bin\Debug\{TARGET FRAMEWORK MONIKER}\publish\. For example, bin\Debug\netcoreapp2. 2\publish\. The dotnet publish command calls MSBuild, which invokes the Publish target.
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>
''' ''''
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With