项目的ItemGroup范围,或者与QUOT;为什么的MSBuild恨我&QUOT?; [英] ItemGroup Item scope, alternatively "Why does MSBuild hate me?"

查看:190
本文介绍了项目的ItemGroup范围,或者与QUOT;为什么的MSBuild恨我&QUOT?;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个解决方案,我试图去建立在TFS。我想更新所有相关文件的版本,我一直在坚持努力完成这件事。有很多关于如何做到这一点联系,但他们没有工作对我来说,由于一个小问题......范围。

I have a solution I'm trying to get to build on TFS. I want to update the versions of all appropriate files, and I've been stuck trying to get this done. There are plenty of links on how to do it, but none of them work for me, due to one little issue... Scope.

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="DesktopBuild" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
    <Target Name="DesktopBuild">
    	<CallTarget Targets="GetFiles"	/>

    	<Message Text="CSFiles: '@(CSFiles)'" />
    </Target>

    <Target Name="GetFiles">
    	<ItemGroup>
    		<CSFiles Include="**\AssemblyInfo.cs" />
    	</ItemGroup>
    	<Message Text="CSFiles: '@(CSFiles)'" />
    </Target>
</Project>



我的树看起来是这样的:

My tree looks like this:


  • test.proj

  • application.sln

  • 应用程序(文件夹)


    • main.cs

    • 属性(文件夹)


      • 的AssemblyInfo.cs

      • test.proj
      • application.sln
      • application (Folder)
        • main.cs
        • Properties (Folder)
          • AssemblyInfo.cs

          当我运行C:\Windows\Microsoft.NET\\ \\Framework\v3.5\MSBuild.exe test.proj从解决方案文件夹...我得到以下输出:

          When I run "c:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe test.proj" from the solution folder... I get the following output:

          Microsoft (R) Build Engine Version 3.5.30729.1
          [Microsoft .NET Framework, Version 2.0.50727.3074]
          Copyright (C) Microsoft Corporation 2007. All rights reserved.
          
          Build started 7/6/2009 3:54:10 PM.
          Project "D:\src\test.proj" on node 0 (default targets).
            CSFiles: 'application\Properties\AssemblyInfo.cs'
          DesktopBuild:
            CSFiles: ''
          Done Building Project "D:\src\test.proj" (default targets).
          
          
          Build succeeded.
              0 Warning(s)
              0 Error(s)
          
          Time Elapsed 00:00:00.04
          

          那么,怎样才能让我的的ItemGroup具有全局范围是什么?用所有的目标文件由编译器和TeamBuild做同样的事情,和他们都似乎是全球性的。我不明白为什么这不是为我工作。

          So, how can I make my ItemGroup have global scope? All the Targets files used by the compiler and TeamBuild do this same thing, and theirs all seem to be global... I don't understand why this isn't working for me.

          任何帮助吗?

          推荐答案

          您是否尝试过使用DependsOnTarget而非CallTarget?这可能是CallTarget引起的范围问题。

          Have you tried using DependsOnTarget rather than CallTarget? It could be that CallTarget is causing the scope issue.

          这篇关于项目的ItemGroup范围,或者与QUOT;为什么的MSBuild恨我&QUOT?;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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