TFS Build在目标文件夹中删除了包括csproj在内的多余文件 [英] TFS Build dropping extra files including csproj in target folder

查看:120
本文介绍了TFS Build在目标文件夹中删除了包括csproj在内的多余文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个自动构建过程,该过程可以从TFS中的构建定义运行,该过程将发布Web应用程序,并通过发布概要文件成功地生成/执行数据库项目脚本,这些概要文件将作为msbuild参数传递到构建过程定义中.现在一切都按预期运行,除了将几个不必要的文件部署到目标文件夹,包括.csproj文件,所有配置转换以及包含我所有发布配置文件的properties文件夹.

I have an automated build process set up to run from a build definition in TFS, which publishes a web application and generates/executes a database project script successfully via publish profiles that are passed as msbuild arguments in the build process definition. Everything is now running as expected except that several unnecessary files are being deployed to the target folder, including the .csproj file, all of the config transforms, and the properties folder which contains all of my publish profiles.

这很奇怪,因为1.它绝对不包括所有文件/文件夹,并且大多数情况下似乎包括诸如转换等发布配置文件使用的文件/文件夹,同时正确地应用了转换并排除了任何明确排除的文件(如pubxml中所定义)和2.如果通过从Visual Studio 2013中的项目发布来完成此过程,则该过程可以完美地工作.我将配置文件配置为仅包含应用程序所需的文件,并且我已经在csproj文件中确认此属性存在

This is strange because 1. It's definitely not including ALL files/folders and mostly appears to be including ones used by the publish profile like transforms, while applying the transform correctly and excluding any explicitly excluded file (as defined in the pubxml), and 2. The process works perfectly if I do it by publishing from the project in Visual Studio 2013. I have the profile configured to only include files needed by the application, and I've confirmed in the csproj file that this property is there.

我尝试从pubxml文件的部署中排除属性文件夹,但这会导致构建崩溃,因为它找不到程序集文件.我收集到的是,该过程将保留完成构建所需的所有文件,并将所有这些文件拖放到我的目标文件夹中. FWIW,我使用的是文件系统"方法,但不确定Web部署是否会有所作为.我还无法通过Web部署连接到目标服务器,但这是一个需要解决的单独问题.我可以配置构建中的某些内容,以便目标文件夹仅包含运行应用程序所需的文件,而没有构建应用程序所需的文件吗?

I tried excluding the properties folder from deployment in the pubxml file, but this causes the build to crash because it can't find the assembly file. What I've gathered is that the process is keeping all files it needs to complete the build, and dropping all of those files in my destination folder. FWIW, I'm using the "file system" method and I'm not sure yet if web deploy will make a difference. I haven't been able yet to connect to the target server with web deploy, but that's a separate problem to solve. Is there something in the build that I can configure so that my destination folder has only the files it needs to run the application, and not the files needed to BUILD the application?

仅供参考,我也没有使用过放置文件夹,我不确定这是否有所不同,但这可能是我唯一未经测试的东西,因为自从使用以来似乎没有必要一个publishprofile,并且不想使用默认的tfs构建配置.

FYI I also have not been using a drop folder, I'm not sure if that makes a difference or not but that might be the only thing I haven't tested as it doesn't seem necessary since I'm using a publishprofile and don't want to use the default tfs build configuration.

推荐答案

在阅读以下内容之后,我发现了一个效果很好的解决方案:

I found a solution that works well enough, after reading this: http://www.asp.net/web-forms/tutorials/deployment/advanced-enterprise-web-deployment/excluding-files-and-folders-from-deployment This was a little uglier solution than I wanted, since it requires hard-coding the names of excluded files, but it does the trick and only requires identifying the files and folders in one location instead of altering a publish profile for each target environment. I created a wpp.targets file and used the ExcludeFromPackageFolders and ExcludeFromPackageFiles elements to identify the extra files. Ironically, if I don't also name the wpp.targets file in the exclude element, THAT file is included in my package. It's possible MSDeploy doesn't have the same issues with TFS as filesystem, but after spending half a day trying to work through a different set of issues and permissions workarounds, we decided that file system is a cleaner publishing method.

这篇关于TFS Build在目标文件夹中删除了包括csproj在内的多余文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆