Listing folders using MSBuild

I am at the end of an Asp.Net MVC 1.0 project in VS2008 / Framework 3.5 and am trying to make some performance optimizations. In my project, I have several different "themes" that are used, depending on the role of the registered user. My folder structure is the same ...

\Themes
    \Theme1
        \Css
            \Folder1
                \CssFile1.css
                \CssFile2.css
            \Folder2
                \CssFile1.css
                \CssFile2.css
        \Images
            <Images go here>
     \Theme2
        \Css
            \Folder1
                \CssFile1.css
                \CssFile2.css
            \Folder2
                \CssFile1.css
                \CssFile2.css
        \Images
            <Images go here>

As new customers arrive on this platform, new topics will be added.

I am using Yahoo! UI Library: YUI Compressor for .Net (which is really cool) to minimize and combine css (and js) files.

I followed the example at http://yuicompressor.codeplex.com/wikipage?title=Sample%20MSBuild.xml%20File&ProjectName=yuicompressor to run the MSBuild script through the post-build event to complete the minify / merge task.

, , - <CssFiles Include="..\Themes\**\*.css" /> ItemGroup, , css, css , ...

\Themes
        \SylesSheetFinal.css

css , css ...

\Themes
        \Theme1
            \StyleSheetFinal1.css
         \Theme2
            \StyleSheetFinal2.css

MSBuild. - , , / ? , , ItemGroup. , MSBuild script Themes .

!

+3
1

, , batching. - ( ) . : . , , , , . , , .

%(). .

<Project ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!-- Batching01.proj -->
  <ItemGroup>
    <Files Include="src\Src01.cs"/>
    <Files Include="src\Src02.cs"/>
    <Files Include="src\Src03.cs"/>
    <Files Include="src\Src04.cs"/>
  </ItemGroup>

  <Target Name="Demo">
    <!-- Not batched, i.e. Files is flattened and sent to the Message task -->
    <Message Text="Files: @(Files)"/>

    <Message Text="================" Importance="high" />

    <Message Text="Filename: %(Files.Filename)" Importance="high" />
  </Target>
</Project>

:

  Files: src\Src01.cs;src\Src02.cs;src\Src03.cs;src\Src04.cs
  ================
  Filename: Src01
  Filename: Src02
  Filename: Src03
  Filename: Src04

, , http://sedotech.com/Resources#Batching.

+3

Source: https://habr.com/ru/post/1728369/


All Articles