embedded resource - dynamically include files using msbuild while preserving relative path? -
i trying include files sec project embeddedresources using next msbuild target:
<createitem include="..\myproject.templates\**\*.css"> <output itemname="embeddedresource" taskparameter="include" /> </createitem>
but included file loose path e.g. ~\views\_layout.cshtml
included _layout.cshtml
(not views._layout.cshtml
desired). there way accomplish desired effect?
msbuild has new methods manipulating items , properties. using these methods, can map resources using itemgroup (instead of createitem), create itemgroup applying msbuild transforms msbuild well-known item metadata. there many item metadata options utilize accomplish desired effect. there's clear illustration of syntax on this answer.
i wrote little script example. creates itemgroup *.exe files , transforms them. tested msbuild 3.5.
<?xml version="1.0" encoding="utf-8" standalone="no" ?> <project defaulttargets="createitems" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <target name="createitems"> <itemgroup> <exe include="..\**\*.exe" /> </itemgroup> <itemgroup> <transformedexe include="@(exe->'%(relativedir)')"/> </itemgroup> <message text="1 - @(exe)" /> <message text="2 - @(transformedexe)" /> </target> </project>
msbuild embedded-resource csproj
No comments:
Post a Comment