Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - MSBuild Include Exclude File List

Reply
 
Old 10-21-2009   #1 (permalink)
granadaCoder


 
 

MSBuild Include Exclude File List

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/archiv...08/546583.aspx
to no avail.


Any help?

Thanks..........

My System SpecsSystem Spec
Old 10-21-2009   #2 (permalink)
granadaCoder


 
 

RE: MSBuild Include Exclude File List


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>




"granadaCoder" wrote:
Quote:

> 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/archiv...08/546583.aspx
> to no avail.
>
>
> Any help?
>
> Thanks..........
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Add include/exclude property support to Export-Csv PowerShell
Re: gci internals: which happens first, include or exclude? PowerShell
gci internals: which happens first, include or exclude? PowerShell
One more question on -LiteralPath and -Include/-Exclude for GetChi PowerShell
Exclude lines that include string PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46