Reputation: 4016
I am using a custom target for publishing my web site to a local folder.
The target (found here) looks like:
<Target Name="PublishToFileSystem"
DependsOnTargets="PipelinePreDeployCopyAllFilesToOneFolder">
<Error Condition="'$(PublishDestination)'==''"
Text="The PublishDestination property must be set to the intended publishing destination." />
<MakeDir Condition="!Exists($(PublishDestination))"
Directories="$(PublishDestination)" />
<ItemGroup>
<PublishFiles Include="$(_PackageTempDir)\**\*.*" />
</ItemGroup>
<Copy SourceFiles="@(PublishFiles)"
DestinationFiles="@(PublishFiles->'$(PublishDestination)\%(RecursiveDir)%(Filename)%(Extension)')"
SkipUnchangedFiles="True" />
</Target>
The corresponding msbuild command looks like:
msbuild projectfile.csproj /p:DeployOnBuild=true /p:VisualStudioVersion=14.0 /p:configuration=Release /p:PublishDestination=C:\inetpub\wwwroot\WebSite /T:PublishToFileSystem
That works fine so far. However, I would like to exclude the APP_DATA directory from publishing.
So, is there a way to exclude the APP_DATA directory from publishing? Maybe by excluding it from the file set defined with <PublishFiles Include="$(_PackageTempDir)\**\*.*" />
?
Environment: Visual Studio 2015 MSBuild Tools 2015
Upvotes: 2
Views: 4389
Reputation: 2003
The easiest way I found is to set this inside the publish profile.
<ExcludeApp_Data>False</ExcludeApp_Data>
Upvotes: 3
Reputation: 4016
It is possible to set the option (suggested by @Vipin Rathore) within the project file:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<ExcludeFoldersFromDeployment>APP_DATA</ExcludeFoldersFromDeployment>
</PropertyGroup>
Upvotes: 0
Reputation: 158
You can do it from solution property. Just right click on solution and choose its property. You will get Package/Publish tab there you just need to check "Exclude files from the App_Data Folder". You can check at attached screen shot.
Hope this can help you.
Upvotes: 2