Tôi có một dự án ứng dụng web:cách đổi tên để triển khai web?
Như bạn có thể thấy, có 3 file robots.txt - một cho mỗi môi trường. Ngoài ra còn có 3 hồ sơ xuất bản.
Hiện tại, đối với mỗi pubxml tôi muốn chọn đúng tệp "robots.xxx.txt" và đổi tên thành "robots.txt". Lý tưởng nhất là tôi muốn tận dụng MSBuild và giữ cấu hình trong mỗi tệp pubxml.
Từng tiểu sử xuất bản 3 đang sử dụng <WebPublishMethod>MSDeploy</WebPublishMethod>
.
EDIT:
Chỉ cần cố gắng Richard Szalay answer, tuy nhiên không có kết quả. Tất cả 3 tệp vẫn được sao chép vào thư mục đầu ra. Đây là hồ sơ xuất bản của tôi trông giống như bây giờ
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<PrecompileBeforePublish>True</PrecompileBeforePublish>
<EnableUpdateable>True</EnableUpdateable>
<DebugSymbols>False</DebugSymbols>
<WDPMergeOption>DonotMerge</WDPMergeOption>
<ExcludeApp_Data>True</ExcludeApp_Data>
<publishUrl>C:\Temp\myproject</publishUrl>
<DeleteExistingFiles>False</DeleteExistingFiles>
</PropertyGroup>
<ItemGroup>
<MsDeployReplaceRules Include="robots">
<ObjectName>filePath</ObjectName>
<Match>robots\.debug\.txt</Match>
<Replace>robots.txt</Replace>
</MsDeployReplaceRules>
</ItemGroup>
</Project>
Cảm ơn bạn đã trả lời. Tôi đã thử mã, nhưng tôi nghĩ rằng tôi đang làm điều gì đó sai trái. Bạn có thể vui lòng xem câu hỏi được cập nhật. – niaher