Why in Bill Gates' name does the VS.NET compiler keep going once an assembly error occurs?

K

Ken Durden

The solution for our new application contains 50 sub-assemblies.

There is a great deal of inter-dependency between them, as is common
for all projects I imagine. So my question is, if an infrastructure
assembly than 49 other assemblies depend on FAILS TO BUILD, why does
the compiler continue to attempt to compile all the other assemblies
blabbering mindlessly that the specified namespace name or assembly
file does not exist.

This is probably my biggest pet peeve with the current release of the
..NET IDE, its especially annoying since CTRL-BREAK hardly ever works.
I can hit it 40 times and the IDE just chugs away until the task list
pops up showing me all the useless errors (typically displayed in the
least useful order).

Two Questions:
1.) Am I missing some option somewhere to switch from stupid IDE mode
to a smarter mode where it stops when it knows going further won't
work?
2.) Is this fixed in the Longhorn release?

Thanks,
-ken
 
G

Guest

Ken

One thing that is good about VS is the ability to program the IDE. Open up the Macro Editor (Tools -> Macros -> Macro IDE) and open the code for the EnvironmentEvents module and then paste the following code somewhere underneath the "Automatically generated code" region. What this macro code does is to STOP the compilation when it hits an error whilst compiling one of the assemblies (i.e. when an error is hit, the IDE won't try to compile any remaining assemblies)..

Private Sub BuildEvents_OnBuildProjConfigDone(ByVal Project As String, ByVal ProjectConfig As String, ByVal Platform As String, ByVal SolutionConfig As String, ByVal Success As Boolean) Handles BuildEvents.OnBuildProjConfigDon
Dim win As Window = DTE.Windows.Item(EnvDTE.Constants.vsWindowKindOutput
Dim ow As OutputWindow = CType(win.Object, OutputWindow

If Success = False The
DTE.ExecuteCommand("Build.Cancel", ""
ow.OutputWindowPanes.Item("Build").OutputString(vbCrLf & "ERROR IN " & Project & " Build Stopped"
End I

ow.OutputWindowPanes.Item("Build").OutputString(Now.ToString
End Su

Private Sub BuildEvents_OnBuildProjConfigBegin(ByVal Project As String, ByVal ProjectConfig As String, ByVal Platform As String, ByVal SolutionConfig As String) Handles BuildEvents.OnBuildProjConfigBegi
Dim win As Window = DTE.Windows.Item(EnvDTE.Constants.vsWindowKindOutput
Dim ow As OutputWindow = CType(win.Object, OutputWindow

ow.OutputWindowPanes.Item("Build").OutputString(Now.ToString
End Su

Hope this is of some use

Gary
 
S

Stu Smith

I've been looking for a solution to this for two years. Why it's not the
default I have no idea, but thankyou!


Gary Milton said:
Ken,

One thing that is good about VS is the ability to program the IDE. Open
up the Macro Editor (Tools -> Macros -> Macro IDE) and open the code for the
EnvironmentEvents module and then paste the following code somewhere
underneath the "Automatically generated code" region. What this macro code
does is to STOP the compilation when it hits an error whilst compiling one
of the assemblies (i.e. when an error is hit, the IDE won't try to compile
any remaining assemblies)...
Private Sub BuildEvents_OnBuildProjConfigDone(ByVal Project As String,
ByVal ProjectConfig As String, ByVal Platform As String, ByVal
SolutionConfig As String, ByVal Success As Boolean) Handles
BuildEvents.OnBuildProjConfigDone
Dim win As Window = DTE.Windows.Item(EnvDTE.Constants.vsWindowKindOutput)
Dim ow As OutputWindow = CType(win.Object, OutputWindow)

If Success = False Then
DTE.ExecuteCommand("Build.Cancel", "")
ow.OutputWindowPanes.Item("Build").OutputString(vbCrLf &
"ERROR IN " & Project & " Build Stopped")
End If

ow.OutputWindowPanes.Item("Build").OutputString(Now.ToString)
End Sub

Private Sub BuildEvents_OnBuildProjConfigBegin(ByVal Project As
String, ByVal ProjectConfig As String, ByVal Platform As String, ByVal
SolutionConfig As String) Handles BuildEvents.OnBuildProjConfigBegin
 
K

Ken Durden

Gary Milton said:
Ken,

One thing that is good about VS is the ability to program the IDE.
Open up the Macro Editor (Tools -> Macros -> Macro IDE) and open the
code for the EnvironmentEvents module and then paste the following
code somewhere underneath the "Automatically generated code" region.
What this macro code does is to STOP the compilation when it hits an
error whilst compiling one of the assemblies (i.e. when an error is
hit, the IDE won't try to compile any remaining assemblies)...
Gary,

This is great. It's still not as good as IMHO the IDE should be able
to do on its own, since ideally it would continue to build
NON-DEPENDENT assemblies, but this will save me alot of time in my
compile & fix cycles.

MS should still definitly incorporate some version of this in their
next release, however, its embaressing that you have to go to such
lengths to get the IDE to behave in a reasonable way.

Thanks,
-ken
 
K

Ken Durden

Open up the Macro Editor (Tools -> Macros -> Macro IDE) and open the
code for the EnvironmentEvents module and then paste the following
code somewhere underneath the "Automatically generated code" region.
What this macro code does is to STOP the compilation when it hits an
error whilst compiling one of the assemblies (i.e. when an error is
hit, the IDE won't try to compile any remaining assemblies)...

Is there anyway to key into the NEW .cs, .h, .cpp file action to
insert a copyright at the top of the file? I can imagine someone
starting a company just creating macros to fill holes in the VS.NET
IDE.

Thanks,
-ken
 
G

Guest

Ken

I have an existing macro that will insert a file header comment section whenever a file is opened if a header section does not already exist in the file. This can be easily adapted for a copyright header if need be. The only downside is that it is triggered whenever a file is opened and not just for newly added files. I was never able to get the code to trigger only when a new file was added as the IDE events associated with this action don't seem to be triggered as I would expect them to

If this is going to be of any use to you then let me know and I will post the macro code required to do this

Gary
 
K

Ken Durden

Gary Milton said:
Ken,

I have an existing macro that will insert a file header comment
section whenever a file is opened if a header section does not already
exist in the file. This can be easily adapted for a copyright header
if need be. The only downside is that it is triggered whenever a file
is opened and not just for newly added files. I was never able to get
the code to trigger only when a new file was added as the IDE events
associated with this action don't seem to be triggered as I would
expect them to.
If this is going to be of any use to you then let me know and I will post the macro code required to do this.

Gary

Gary,
This seems pretty useful, if anything it will help update older files
which have forgotten to have their copyright put in place.

Thanks for all your help,
-ken

PS: Got any other neat macro tricks up your sleeve?
 
G

Gary Milton

Hi Ken,

There is a fair amount of code which is wrapped up in a module so it would
be better if I emailed this to you so you can just simply import it through
the Macro IDE. If you can confirm your email address then I will send this
to you.

Gary
 
K

Ken Durden

Gary Milton said:
Hi Ken,

There is a fair amount of code which is wrapped up in a module so it would
be better if I emailed this to you so you can just simply import it through
the Macro IDE. If you can confirm your email address then I will send this
to you.

Gary

Thanks Gary,
My email I'm using to post is accurate: (e-mail address removed)

Thanks alot for your help,
-ken
 

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