[Mono-bugs] [Bug 594511] New: xbuild can't override targets from imported file

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Apr 7 14:10:46 EDT 2010


http://bugzilla.novell.com/show_bug.cgi?id=594511

http://bugzilla.novell.com/show_bug.cgi?id=594511#c0


           Summary: xbuild can't override targets from imported file
    Classification: Mono
           Product: Mono: Tools
           Version: 2.4.x
          Platform: x86-64
        OS/Version: Ubuntu
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: xbuild
        AssignedTo: jankit at novell.com
        ReportedBy: eli at wavemarket.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Created an attachment (id=352939)
 --> (http://bugzilla.novell.com/attachment.cgi?id=352939)
contains project files described in test steps

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8)
Gecko/20100214 Ubuntu/9.10 (karmic) Firefox/3.5.8

Xbuild doesn't seem to let me override a target that's defined in an imported
file; the imported target always overrides any target of the same name from the
main project file, regardless of whether it appears before or after the import.
This makes standard hooks like "BeforeBuild", defined in
Microsoft.Common.targets, impossible to use.

Reproducible: Always

Steps to Reproduce:
1. Create project file "other.targets" with the following targets:
   <Target Name="Build" DependsOnTargets="BeforeBuild">
     <Message Text="This is Build from other.targets"/>
   </Target>
   <Target Name="BeforeBuild">
     <Message Text="This is BeforeBuild from other.targets"/>
   </Target>

2. Create project file "test1.csproj" whose DefaultTargets attribute is
"Build", containing the following tasks:
   <Import Project="other.targets"/>
   <Target Name="BeforeBuild">
     <Message Text="This is BeforeBuild from test1.csproj"/>
   </Target>

3. Create "test2.csproj" which is exactly the same, except that the BeforeBuild
target is defined *before* the import.

4. Run "xbuild test1.csproj" and "xbuild test2.csproj".
Actual Results:  
The output in both cases shows that it's using the BeforeBuild target from
other.targets and ignoring the one from the main project.

Expected Results:  
If it worked the same as msbuild, then the most recently defined version of the
target should win. So in test1.csproj it would run the BeforeBuild target from
test1.csproj, and in test2.csproj it would still use the one from
other.targets.

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list