TFS MSBuild:$(ProjectDir)空白或随机 [英] TFS MSBuild: $(ProjectDir) blank or random

查看:83
本文介绍了TFS MSBuild:$(ProjectDir)空白或随机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个vcproj文件,其中包括一个简单的预构建事件,内容如下:

I have a vcproj file that includes a simple pre-build event along the lines of:

Helpertask.exe $(ProjectDir)

这在开发人员PC上运行良好,但是当该解决方案在MSBuild下的TFS 2008构建服务器上构建时,$(ProjectDir)为空或指向服务器上不相关的文件夹!

This works fine on developer PCs, but when the solution is built on our TFS 2008 build server under MSBuild, $(ProjectDir) is either blank or points to an unrelated folder on the server!

到目前为止,我管理的最好的解决方法是对开发人员和服务器路径进行硬编码:

So far the best workaround I have managed is to hard code the developer and server paths instead:

if exist C:\DeveloperCode\MyProject   HelperTask.exe C:\DeveloperCode\MyProject
if exist D:\BuildServerCode\MyProject HelperTask.exe D:\BuildServerCode\MyProject

此hack在发布-构建步骤中有效,但在 pre 构建步骤中无效(Pre-build任务现在在MSBuild下完全不起作用!)

This hack works in post-build steps but it doesn't work for a pre-build step (the Pre-build task now does nothing at all under MSBuild!)

您对修复或解决方法有任何想法吗?我只剩下很少的头发了!

Do you have any ideas for a fix or workaround? I have very little hair left!

推荐答案

我一直对此遇到问题-我尝试了许多不同的方法,但是它们都以神秘的方式失败了.

I just kept getting problems with this - I tried many different approaches but they all failed in mysterious ways.

一旦$(ProjectDir)重新开始正常运行,预构建步骤便停止执行该命令(我在其上方和下方添加了echo命令-它们都已执行,但是它们之间的程序却没有执行.没有错误或输出.会生成任何类型的内容以表明失败的原因.

Once $(ProjectDir) started behaving properly again, the pre-build step stopped executing the command (I added echo commands above and below it - they were both executed, but the program in between them was not. No errors or output of any kind were generated to indicate why it failed).

我不知道这是否是MSBuild是否在笑的狡猾服务器.

I don't know if this is a dodgy server of if MSBuild is having a laugh.

我已经放弃了.我给构建服务器起了很大的作用,并且做出了一些改变:现在,我们离线(手动)运行此工具,并检查结果以供构建服务器使用.对于自动化构建而言,是如此之多:-(如果只有MSBuild可以以与Visual Studio相同的方式运行解决方案-令人惊讶的是,它完全不同地设置了环境(来自解决方案变量的不同路径,ouptus重定向到了不同的文件夹,因此您找不到它们应该在的位置,等等)

I've given up now. I gave the build server a big kick and have changed tack: We now run this tool offline (manually) and check in the results for the build server to use. So much for an automated build :-( If only MSBuild would run solutions in the same way as Visual Studio does - it's maddening that it sets up the environment completely differently (different paths coming out of the solution variables, ouptus redirected into different folders so you can't find them where they're supposed to be, etc)

这篇关于TFS MSBuild:$(ProjectDir)空白或随机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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