MSBuild taking forever to check timestamps when started from VS
I have a MSBuild file that uses item batching to send a bunch of files into a task. The target uses a vector of items for input and output.
When I run msbuild from the command line (I run make which then blindly calls msbuild), msbuild checks timestamps almost instantly and skips task execution (nothing to build).
When I call make from Visual Studio (make then blindly calls msbuild) the timestamp comparison takes around 20 seconds.
Any ideas? What is going on?
My msbuild file looks like this:
<!-- All items ha开发者_开发知识库ve metadata and look like this -->
<MyItem Include="Ignored">
<Out>SomeFile.cpp</Out>
<Src>SomeFile.xml</Src>
<Tem>SomeFile.xyz</Tem>
<Mod />
</MyItem>
<!-- My main target looks like this -->
<Target Name="GenerateCode"
Outputs="@(MyItem->'%(Out)')"
Inputs="@(MyItem->'%(Src)');@(MyItem->'%(Tem)');@(MyItem->'%(Mod)')"
DependsOnTargets="CreateOutputDirs">
<!-- ... -->
</Target>
Looks like when VS calls a tool it does not pass all environmental variables and sdk paths. VS ended up calling MSBuild 2.0 instead of 3.5
This post may help: http://blogs.msdn.com/msbuild/archive/2007/04/13/recursion-and-itemgroups-inside-targets.aspx
精彩评论