all groups > visual studio .net ide > march 2004 >
You're in the

visual studio .net ide

group:

Exclude file from build


Exclude file from build Jonathan Turkanis
3/23/2004 10:59:06 AM
visual studio .net ide: After using Visual Studio for years, I just discovered the 'exclude
from build' property on the property pages for source files, a feature
which I find extremely useful on other IDEs, such as Codewarrior.
Unfortunately, I don't see a way to tell at a glance which files are
excluded. Can this be done without viewing the property pages for each
item?

Thanks for your help.

Jonathan

Re: Exclude file from build Henk Verhoeven
3/25/2004 10:10:10 AM
Hi Jonathan

Have you tried the solution properties->configuration properties->
configuration

This page allows you to "exclude" projects from the build, however; this
means that any change you make to those "excluded projects" will not be
compiled and copied to the projects that reference it.

Henk
[quoted text, click to view]

Re: Exclude file from build Jonathan Turkanis
3/25/2004 10:36:32 AM
Thanks, Henk. I never noticed this option either.

I'm trying to build a bunch of regression tests for one projects.
There are several dozen .cpp files which define main, and I want to
build and run them separately. 'Exclude from build' would seem a
natural choice here, but it's too hard to remember which file is
currently included.

Jonathan


[quoted text, click to view]

Re: Exclude file from build Julie
3/26/2004 10:08:47 AM
[quoted text, click to view]

I just noticed (and posted) the same issue.

Seems to me like a *MAJOR* oversight by the UI conformance team for VS.NET.

Don't any MS reps read this newsgroup? I've yet to hear an answer to this
problem -- and it is definitely a problem.

Re: Exclude file from build Julie
3/26/2004 2:23:53 PM
[quoted text, click to view]

Yes, I've noticed the *exact* same thing. A lot of language issues do get lip
service from MS techs. This forum seems to be comparatively dead. I guess the
Re: Exclude file from build Jonathan Turkanis
3/26/2004 2:45:27 PM

[quoted text, click to view]
VS.NET.

I agree.

[quoted text, click to view]

I've had good luck getting responses from microsoft people over at
microsoft.public.dotnet.languages; unfortunately, this would be a bit
off-topic. Maybe if no one responds here in a few days I'll post
there.

Jonathan

Re: Exclude file from build Graeme Prentice
3/27/2004 4:30:34 AM
[quoted text, click to view]

Hi Jonathan

I'm fairly new to VS but I've been interested to learn more about
writing macros and addins so I had a go at writing a macro to display
the included and excluded files for a project in the output window.
You'll probably have to change it to what you need. I mostly copied the
examples in the VS macro help - one VS example didn't work - I had to
use the col2 variable instead of file.FileConfigurations directly (as a
VS example does).

I'm unsure about creating a new output window pane - you might end up
with a bunch of new output window panes you don't want, so hopefully you
can change this if it doesn't look right. It appears to work for me.
You need to add Microsoft.VisualStudio.VCProjectEngine to the
"references" in the macro IDE - as the comment at the start shows. I
think this comment came from a VS example that I found by clicking on
help in the file configuration properties window, then clicking on
"ExcludedFromBuild". I think the macro below iterates through all open
projects but I only tried it with one open project. You might need to
clear the output window (there's a method for this) at some stage, but
it seemed to clear every time I ran the macro so I didn't add it. Also
I didn't try to figure out how to leave out header files and resource
files etc.

Graeme


' add reference to Microsoft.VisualStudio.VCProjectEngine
Imports EnvDTE
Imports Microsoft.VisualStudio.VCProjectEngine

Public Module Module1
Sub Test()
' Create a tool window handle for the Output window.
Dim win As Window =
DTE.Windows.Item(EnvDTE.Constants.vsWindowKindOutput)
' Create handles to the Output window and its panes.
Dim OW As OutputWindow = win.Object
Dim OWp As OutputWindowPane

' Add a new pane to the Output window.
OWp = OW.OutputWindowPanes.Add("Project build exclude file
list")

Dim idx, idx2, idp As Integer
Dim file As VCFile
Dim col As IVCCollection
Dim col2 As IVCCollection
Dim fileconfig As VCFileConfiguration
Dim allproj As Projects
Dim prj As VCProject

allproj = DTE.Solution.Projects
For idp = 1 To allproj.Count
prj = allproj.Item(idp).Object
col = prj.Files
OWp.OutputString("PROJECT " + prj.Name + Chr(10))
For idx = 1 To col.Count
file = col.Item(idx)
col2 = file.FileConfigurations
OWp.OutputString(" " + file.Name + Chr(10))
For idx2 = 1 To col2.Count
fileconfig = col2.Item(idx2)
If fileconfig.ExcludedFromBuild Then
OWp.OutputString(" Excluded ")
Else
OWp.OutputString(" Included ")
End If
OWp.OutputString(col2.Item(idx2).Name() + Chr(10))
Next
Next
Next
OW.Parent.Activate()
OWp.Activate()

End Sub
End Module
AddThis Social Bookmark Button