Adding a new target type to msbuild: How do I refer to the itemname in the task rules?
Posted
by jmucchiello
on Stack Overflow
See other posts from Stack Overflow
or by jmucchiello
Published on 2010-06-09T21:24:57Z
Indexed on
2010/06/09
21:52 UTC
Read the original article
Hit count: 315
visual-studio-2010
|msbuild
I'm trying to add a task to build the COM proxy DLL after building the main DLL. So I created the following in a .target file:
<Target Name="ProxyDLL"
Inputs="$(IntDir)%(WHATGOESHERE)_i.c;$(IntDir)dlldata.c"
Outputs="$(OutDir)%(WHATGOESHERE)ps.dll"
AfterTargets="Link">
<CL Sources="$(IntDir)%(WHATGOESHERE)_i.c;$(IntDir)dlldata.c" />
</Target>
And reference it from the .vcxproj file as
<ItemGroup>
<ProxyDLL Include="FTAccountant" />
</ItemGroup>
So the FTAccountant.DLL file is created through the normal build process and then when attempts to compile the proxy stubs it creates these command lines:
cl /c dir\_i.c dir\dlldata.c
And of course it can't find _i.c. The first attempt, I put %(Filename) in the WHATGOESHERE space and I got this error:
C:\ActivePay\Build\Proxy DLL.targets(6,3): error MSB4095: The item metadata
%(Filename) is being referenced without an item name. Specify the item name by
using %(itemname.Filename).
So I changed it to %(itemname.Filename) and that is an empty string. How to get the value specified in the task's Include attribute and use it within the task?
© Stack Overflow or respective owner