Seems like it should be fairly simple but I'm having trouble excluding folders when using the MSBUILD copy task. Here's what I'm doing:
<ItemGroup>
<Compile Include="$(_SolutionPath)$(_SolutionName)" />
<ProjectFiles Include="..\$(_WebDirectory)\*.csproj" Exclude="*.master.csproj"/>
<ExcludeFromBuild Include="..\$(_WebDirectory)\**\*.cs; ..\$(_WebDirectory)\**\*.sln; ..\$(_WebDirectory)\**\*.csproj; ..\$(_WebDirectory)\Web References; ..\$(_WebDirectory)\obj;"/>
<AppFolder Include="..\$(_WebDirectory)\**\*.*" Exclude="$(ExcludeFromBuild)"/>
</ItemGroup>
<Copy SourceFiles="@(AppFolder)" DestinationFiles="c:\test\%(RecursiveDir)%(FileName)%(Extension)"/>
In the item group section I have an ExcludeFromBuild item which lists开发者_如何学C out the file types i want to exclude. On top of that I want to exclude the "obj" and "Web References" folder.
How can I accomplish this? Please let me know if more information is needed. Thank you.
shahzad
You need to create a new ItemGroup for that. I've added AppFolderWithExclusions
below:
<ItemGroup>
<Compile Include="$(_SolutionPath)$(_SolutionName)" />
<ProjectFiles Include="..\$(_WebDirectory)\*.csproj" Exclude="*.master.csproj"/>
<ExcludeFromBuild Include="..\$(_WebDirectory)\**\*.cs; ..\$(_WebDirectory)\**\*.sln; ..\$(_WebDirectory)\**\*.csproj; ..\$(_WebDirectory)\Web References; ..\$(_WebDirectory)\obj;"/>
<AppFolder Include="..\$(_WebDirectory)\**\*.*" Exclude="$(ExcludeFromBuild)"/>
<AppFolderWithExclusions Include="@(AppFolder)" Exclude="obj\**\*.*;Web References\**\*.*" />
</ItemGroup>
(untested; may include syntax typos)
精彩评论