MSBuild Include Exclude File List

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..........
 
G

granadaCoder

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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top