Web部署项目AfterBuild路径问题

发布于 2024-08-19 10:49:35 字数 611 浏览 4 评论 0原文

我目前正在为一个网络项目设置构建服务器。我正在使用 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".

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

I'm currently in the process of setting up a build server for a web project. I'm using Web Deployment Project to create a deployable package and I want to do some simple file administration (copy webDeploy.config -> web.config and delete .csproj files).

My target looks as follows:

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

However, inspecting the output of the WDP gives me this

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".

The Deployment path does indeed contain a Debug path. What am I doing wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

淡忘如思 2024-08-26 10:49:36

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

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

If you want to use wildcards you will have do so in an item list. The item list will take care of expanding the wild cards for you. So in your case:

<Target Name="AfterBuild">      
    <ItemGroup>
        <FilesToDelete Include="$(OutputPath)\*.csproj" />
    </ItemGroup>
    <Delete Files="@(FilesToDelete)" />
</Target>
同展鸳鸯锦 2024-08-26 10:49:36

我自己尝试了一下,很震惊,但解释很简单:你不能使用通配符 (MSBuild 团队博客)。

样本:

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

<Target Name="AfterBuild">      
    <Delete Files="@(ProjectConfigFiles)" />
</Target>

I tried it myself and was stunned but the explanation is simple: You cannot use wildcards (MSBuild Team Blog).

Sample:

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

<Target Name="AfterBuild">      
    <Delete Files="@(ProjectConfigFiles)" />
</Target>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文