I need better file nesting.
I have Index.razor, Index.razor.cs, Index.Model.cs, Index.Interface.cs inside the Pages folder.
In csproj
I have
<ItemGroup>
<Compile Update="Pages\Index.razor.cs" DependentUpon="Pages\Index.razor" />
<Compile Update="Pages\Index.Model.cs" DependentUpon="Pages\Index.razor" />
<Compile Update="Pages\Index.Interface.cs" DependentUpon="Pages\Index.razor" />
</ItemGroup>
I created this functionality into Wildcard
<ItemGroup>
<Compile Update="**\*.Interface.cs" DependentUpon="$([System.String]::Copy('%(FileName)').Replace('.Interface', '.razor'))" />
<Compile Update="**\*.Model.cs" DependentUpon="$([System.String]::Copy('%(FileName)').Replace('.Model', '.razor'))" />
</ItemGroup>
What I want is better version of this
<ItemGroup>
<Compile Update="**\*.Interface.cs" Condition="Exists('Check Razor')" >
<DependentUpon>"$([System.String]::Copy('%(FileName)').Replace('.Interface', '.razor'))"</DependentUpon>
</Compile>
<Compile Update="**\*.Model.cs" Condition="Exists('Check Razor')" >
<DependentUpon>"$([System.String]::Copy('%(FileName)').Replace('.Model', '.razor'))"</DependentUpon>
</Compile>
<Compile Update="**\*.Interface.cs" Condition="Exists('Check cshtml')" >
<DependentUpon>"$([System.String]::Copy('%(FileName)').Replace('.Interface', '.cshtml'))"</DependentUpon>
</Compile>
<Compile Update="**\*.Model.cs" Condition="Exists('Check cshtml')" >
<DependentUpon>"$([System.String]::Copy('%(FileName)').Replace('.Model', '.cshtml'))"</DependentUpon>
</Compile>
Need to check here also
<Compile Update="**\*.Interface.cs" DependentUpon="$([System.String]::Copy('%(FileName)').Replace('.Interface', '.cs'))" />
<Compile Update="**\*.Model.cs" DependentUpon="$([System.String]::Copy('%(FileName)').Replace('.Model', '.cs'))" />
</ItemGroup>
So that I can use Isolation in cshtml and razor project without hasle.
For example to work in xaml, you can use MSBuild15's static update syntax.
<Compile Update="**\*.xaml.cs" DependentUpon="%(Filename)" />
MSbuild splits paths into ( => ) and ( => ), so it can be used to reference xaml files.
Filenamefoo.xaml.csfoo.xamlExtensionfoo.xaml.cs.cs%(Filename)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.