Home Delphi XE custom build target is always disabled
Reply: 0

Delphi XE custom build target is always disabled

user1956
1#
user1956 Published in June 25, 2018, 3:55 am

I've created a custom MSBuild .targets file that I've included in a Delphi XE project via the IDE and enabled it from the Project Manager's context menu. Although the file validates, it always gets disabled after I re-save the project file.

Here's a simplified version of the targets file, named Custom.targets.

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Target Name="Hello">
    <Message Text="Hello from custom target"/>
  </Target>
</Project>

As a stand alone file this works as expected: typing...

MSBuild Custom.target /t:Hello

...at the command line gives the expected message.

Adding Custom.targets to a Delphi project via the IDE displays the file in the Project Manager as expected, and the .dproj file now contains the line...

<TargetsFile Include="Custom.targets"/>

I right-clicked the file in the IDE's Project Manager and selected Enable. But when the project is built the Build message window displays:

[MSBuild Warning] Custom.targets(1): Ignoring disabled import: PathToProjectSource\\Custom.targets

Right-clicking again in Project Manager still shows the Enable option instead of the expected Disable.

At the command line MSBuild ProjectName.dproj /t:Hello also fails.

I've tried hacking the .dproj file to add the line...

<Import Project="Custom.targets"/>

Typing MSBuild ProjectName.dproj /t:Hello now works. But the next time I save the project file from the IDE the <Import> statement gets removed.

Anyone got any idea what's going wrong please?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.305602 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO