• Upgrade your Internet Experience
  • Sign in
  • Microsoft.com
  • United States (English)
    Brasil (Português)Česká republika (Čeština)Deutschland (Deutsch)España (Español)France (Français)Italia (Italiano)Россия (Русский)대한민국 (한국어)中华人民共和国 (中文)台灣 (中文)日本 (日本語)香港特别行政區 (中文)
 
 
.NET Framework Developer Center
 
 
Home
 
 
Library
 
 
Learn
 
 
Downloads
 
 
Support
 
 
Community
 
 
Forums
 
 
 
.NET Framework Developer Center > .NET Development Forums > MSBuild > Any change in the processing of Exists() between 2.0 and 3.5
Ask a questionAsk a question
Search Forums:
  • Search MSBuild Forum Search MSBuild Forum
  • Search All .NET Development Forums Search All .NET Development Forums
  • Search All MSDN Forums Search All MSDN Forums
 

Proposed AnswerAny change in the processing of Exists() between 2.0 and 3.5

  • Monday, July 21, 2008 3:32 PMGaelFraiteur Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Vote As Helpful
    0
    Consider an Exist function on an Import element, for instance:

    <Import Project="PostSharp-Samples-Src.targets" Condition="Exists('PostSharp-Samples-Src.targets')"/>


    Now suppose this Import is in a .targets file, i.e. it is imported for, say, a .csproj, that it in a different directory as the .targets file.

    In 2.0, the argument of the Exist method is resolved relatively to the directory of the .targets file, which is the only meaningful to process relative paths in .targets files. However, in 3.5, the same technique (and actually the same code) does not work.

    Can anyone give some explanation about this?

    Thanks,

    -Gael


    Gael Fraiteur -- postsharp.org
    • ReplyReply
    • QuoteQuote
     

All Replies

  • Monday, September 22, 2008 3:02 PMDanMoseley - MSFTModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Proposed Answer
    Vote As Helpful
    0
    I believe we may have broken this in MSBuild 3.5, which is very embarrassing.
    All I can suggest is that you somehow use a full path.
    Dan -- MSBuild
    developer on msbuild
    • Proposed As Answer byChris Eargle Tuesday, September 23, 2008 8:55 PM
    •  
    • ReplyReply
    • QuoteQuote
     
  • Tuesday, September 23, 2008 9:11 PMChris Eargle Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Vote As Helpful
    0
    I verified that this behavior is different between 2.0 and 3.5. I would recommend removing the condition if the file will always be there (note that the import behavior didn't change). In many cases it is preferable to receive an error if the file failed to import.
    KodefuGuru.com - Life Student of the Kodefu Arts
    • ReplyReply
    • QuoteQuote
     
Need Help with Forums? (FAQ)
 
© 2009 Microsoft Corporation. All rights reserved.
Terms of Use
|
Trademarks
|
Privacy Statement