MSBuild 脚本获取“Win32Exception:系统找不到指定的文件" [英] MSBuild Script gets "Win32Exception: The system cannot find the File Specified"
问题描述
我已经构建了一个 MSBuild 脚本,该脚本可以自动将我们编程团队签入的最新代码每日部署到 2 或 3 个服务器(取决于参数)中的一个进行测试.我还编写了一个快速 BAT 文件来启动它,它只使用给定的参数调用MSBuild.exe".在 MSBuild 脚本中,它做的第一件事是从 TFS获取最新信息".这是一个代码片段...
I have built an MSBuild script that automates a daily deployment of the most recent code checked in for our programming team to one of 2 or 3 servers (depending on paramaters) for testing. I also wrote a quick BAT file to start it that just calls "MSBuild.exe" with the given parameters. Within the MSBuild script, the first thing it does is a "Get Latest" from TFS. Here is a code snippet...
<Project DefaultTargets="BuildLatest" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="C:\Program Files (x86)\MSBuild\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>
<UsingTask AssemblyFile="C:\Program Files\MSBuild\ExtensionPack\4.0\MSBuild.ExtensionPack.dll" TaskName="TFSSource"/>
...
<PropertyGroup>
<TFSourceLoc>$/SourceCode</TFSourceLoc>
</PropertyGroup>
...
<Target Name="BuildLatest" >
<TFSSource TaskAction="Get" ItemCol="$(TFSourceLoc)" />
</Target>
错误又回来了...错误 ...\AutoDeploy.xml(163,5): Win32Exception: 系统找不到指定的文件
The error comes back... ERROR ...\AutoDeploy.xml(163,5): Win32Exception: The system cannot find the file specified
... BAT 文件结束.
... and the BAT file ends.
真正奇怪的是我可以最小化 VS 2010 并从资源管理器中运行这个完全相同的 BAT 文件,没有任何问题.
The really weird thing is that I can minimize VS 2010 and run this exact same BAT file from Explorer with no issues.
所以我没有看到什么?为什么这不能从 VS 2010 中运行?
So what am I not seeing? Why won't this run from within VS 2010?
预先感谢您的帮助!
推荐答案
我做了更多的研究,这应该在我提出问题之前发生,但无论如何......
I did a lot more research, which should have happened before I asked the question, but anyways...
我决定尝试直接调用 MSBuild.exe 并将我的参数(随着新 Sprint 每隔几周更改一次)放在通用响应文件中的建议,而不是调用批处理文件.
Instead of calling a batch file, I decided to try the suggestion of calling MSBuild.exe directly and putting my parms (which will change every couple weeks with a new Sprint) in generic Response files.
我认为这是通过在外部工具"对话框中指定正确的目录来解决的开始/初始目录的问题.
I believe it was an issue with the Start/Initial Directory that was resolved by specifying the right directories on the "External Tools" dialog box.
这篇关于MSBuild 脚本获取“Win32Exception:系统找不到指定的文件"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!