I want to use MSBuild to grab and create the relevent elements for 2 files. If it was just a single file extension, I would use:
<ItemGroup>
<Compile Include="\Pages\*.cs" />
</ItemGroup>
In a .csproj file for a Silverlight build, each UserControl is set like with it's own <Compile>
element and a child <DependentUpon>
element:
<ItemGroup>
<Compile Include="Pages\SilverlightControl1.xaml.cs">
<DependentUpon>SilverlightControl1.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\SilverlightControl2.xaml.cs">
<DependentUpon>SilverlightControl2.xaml</DependentUpon>
</Compile>
</ItemGroup>
In the MSBuild file, I'd like to specify:
grab all the
.cs
files and put those in theInclude
attribute and get the same file name - minus the.cs
and put that in the<DependentUpon>
element.
So that it would just be something like (pseudo) to match the file pairs:
<ItemGroup>
<Compile Include="Pages\*.cs">
<DependentUpon>Pages\*.xaml</DependentUpon>
</Compile>
</ItemGroup>
Is there a way to do put the above in MSBuild?