2010-02-26 53 views

Trả lời

9

Tôi cũng cần loại trừ một số tệp, tôi muốn xóa các tệp .xml khỏi triển khai (tôi không cần chúng trên máy chủ), tôi không thể tìm thấy bất kỳ thứ gì trên web nên tôi quyết định tìm kiếm nó trên của riêng tôi.

Sau khi đào sâu vào các msbuild của MsPublish tôi tìm thấy nó, bạn cần phải thiết lập sau đây trong dự án của bạn (chỉnh sửa manualy các csproj):

<ItemGroup> 
    <!-- This will exclude the .xml files from the bin folder -->  
    <ExcludeFromPackageFiles Include="$(OutputPath)*.xml" /> 

    <!-- This will exclude the tmp folder from the bin folder -->  
    <ExcludeFromPackageFolders Include="$(OutputPath)tmp" /> 
</ItemGroup> 
+0

Cảm ơn các thư mục bin * .xml recipe - chính xác những gì tôi cần! – ShadowChaser

+1

Tôi gặp lỗi khi thử điều này "Liên kết phần tử ItemGroup trong không gian tên 'với msbuild 2003' có phần tử con không hợp lệ" ExcludeFromPackageFiles ". –

1

chỉ để làm rõ các ItemGroup bao gồm nên sau sau khi nhập sau đây trong .csproj của bạn:

<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" /> 

ví dụ:

<ItemGroup> 
    <ExcludeFromPackageFiles Include="Sample.Debug.xml"> 
    <FromTarget>Project</FromTarget> 
    </ExcludeFromPackageFiles> 
</ItemGroup> 

Sayed Ibrahim Hashimi có một bài viết tốt về điều này: http://sedodream.com/2010/05/01/WebDeploymentToolMSDeployBuildPackageIncludingExtraFilesOrExcludingSpecificFiles.aspx

Các vấn đề liên quan