문제

I have list of items like this:

<ItemGroup>
    <ToCompile Include="clojure\core.clj;clojure\set.clj;clojure\zip.clj;clojure\test\junit.clj;"/>
</ItemGroup>

And I want to transform that to a list of items like this:

clojure.core clojure.set clojure.zip clojure.test.junit

Is there a way to do this with MSBuild transforms? I tried but I can only get at the file name; the extension and the root path, and I can change the separator. But not the path separators.

If not, any other solution that avoids using custom tasks is appreciated.

도움이 되었습니까?

해결책

This is a bit cheesy, but it works in MSBuild 4.0+.

<Target Name="Namespaces">
  <PropertyGroup>
    <Cheesy>@(ToCompile -> '%(relativedir)%(filename)', ' ')</Cheesy>
  </PropertyGroup>
  <Message Text="$(Cheesy.Replace(`\`, `.`))" />
</Target>

다른 팁

We can do it easily with fewer cheese:

<Message Text="$([System.String]::Copy('%(ToCompile.Identity)').Replace('.clj','').Replace('\','.'))"/>

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top