3

我目前正在为 Web 项目设置构建服务器。我正在使用 Web 部署项目来创建一个可部署的包,并且我想做一些简单的文件管理(复制 webDeploy.config -> web.config 并删除 .csproj 文件)。

我的目标如下所示:

<Target Name="AfterBuild">      
    <Delete Files="$(OutputPath)\*.csproj" />
</Target>

但是,检查 WDP 的输出给了我这个

Target "AfterBuild" in file "C:\project\Deployment\Project.Deployment.wdproj": 
    Task "Delete"
        File ".\Debug\*.*" doesn't exist. Skipping.   
    Done executing task "Delete". 
Done building target "AfterBuild" in project "Project.Deployment.wdproj".

部署路径确实包含调试路径。我究竟做错了什么?

4

2 回答 2

7

如果您想使用通配符,您必须在项目列表中这样做。项目列表将负责为您扩展通配符。所以在你的情况下:

<Target Name="AfterBuild">      
    <ItemGroup>
        <FilesToDelete Include="$(OutputPath)\*.csproj" />
    </ItemGroup>
    <Delete Files="@(FilesToDelete)" />
</Target>
于 2010-01-28T22:46:25.180 回答
0

我自己试过,惊呆了,但解释很简单:你不能使用通配符MSBuild Team Blog)。

样本:

<ItemGroup>
    <ProjectConfigFiles Include="$(OutputPath)\*.csproj" />
</ItemGroup>

<Target Name="AfterBuild">      
    <Delete Files="@(ProjectConfigFiles)" />
</Target>
于 2010-01-28T17:34:57.630 回答