MSBuild Include Exclude File List

  • Thread starter Thread starter granadaCoder
  • Start date Start date
G

granadaCoder

I've been googling (:::::err binging) for a bit now, and cannot figure out
the magic syntax.


C:\MySolution1\
C:\MySolution1\MyProject1\
C:\MySolution1\MyProject2\
C:\MySolution1\MyProject3\
C:\MySolution1\StrongDataSets\


$(SolutionDirectory) points to C:\MySolution1\


I want to
a. include all .cs files under (and nested in folders) in $(SolutionDirectory)
(aka, all the .cs files in
C:\MySolution1\MyProject1\
C:\MySolution1\MyProject2\
C:\MySolution1\MyProject3\
)

b.
I want to exclude
all instances of:
Designer.cs

c.
I want to exclude
all instances of:
AssemblyInfo.cs

d.
I want to exclude a specific subfolder:
C:\MySolution1\StrongDataSets\
(or $(SolutionDirectory)\StrongDataSets)

(because of the amount of auto generated code that comes along with any
strong datasets)

I haven't even got b. and c. to work at the same time.
Below is my (b.) and (c.) attempt (which doesn't include (d.)).

:<


<ItemGroup>
<StyleCopFiles Include="$(SolutionDirectory)\**\*.cs"
Exclude="$(SolutionDirectory)\**\*.Designer.cs;$(SolutionDirectory)\**\*.AssemblyInfo.cs" />
</ItemGroup>



I've been through a bunch of trial and errors from this blog post:
http://blogs.msdn.com/msbuild/archive/2006/03/08/546583.aspx
to no avail.


Any help?

Thanks..........
 
I think I figured out the magically syntax!



<ItemGroup>
<StyleCopExcludedFiles Include="$(SolutionDirectory)\**\*.Designer.cs" />
<StyleCopExcludedFiles
Include="$(SolutionDirectory)\**\*AssemblyInfo.cs" />
</ItemGroup>


<ItemGroup>
<StyleCopFiles Include="$(SolutionDirectory)\**\*.cs"
Exclude="@(StyleCopExcludedFiles)" />

</ItemGroup>
 
Back
Top