Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / General / October 2004

Tip: Looking for answers? Try searching our database.

Complex build for C# projects with custom tools

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Barry Kelly - 20 Oct 2004 12:23 GMT
I've got a slightly complex build process for the project I'm working on.
I'm using ANTLR to generate parsers and lexers, and using custom-built tools
to generate various data files which are needed for starting up a debug
instance.

I'm looking for something in VS 2003 similar to a makefile's capability to
specify files, how to build them and what they depend on.

For example:

---8<---
ScriptLexer.cs : confscript.g
   antlr confscript.g
--->8---

I've tried associating a batch file with the project, but there's a problem:
VS.NET doesn't detect that source code files have changed as a result of
tool execution and seems to use buffered in-memory versions of old source,
and so I need to build 2, 3 or more times before I have a debug executable
which correctly reflects the current state.

As I'm sure you can imagine, a number of times I've tried to debug a problem
that I'd already fixed - but the debug .exe was out of date.

At this stage, I've started using GNU make from the command-line to build my
project. What can I do to make VS.NET understand my dependencies?

-- Barry Kelly
Paul Wistrand - 22 Oct 2004 10:38 GMT
Have you not tried NAnt?

> I've got a slightly complex build process for the project I'm working on.
> I'm using ANTLR to generate parsers and lexers, and using custom-built tools
[quoted text clipped - 24 lines]
>
> -- Barry Kelly
Barry Kelly - 26 Oct 2004 09:24 GMT
> > I've got a slightly complex build process for the project I'm working
> > on.
> > [...]
> > What can I do to make VS.NET understand my dependencies?
>
> Have you not tried NAnt?

I don't perceive NAnt as being part of Visual Studio. That is, I don't
expect I could depend on it being installed when the project is checked out
of source control on a new machine.

I'm not sure it gives me any benefits above make; I already know how to use
make. How do I benefit by learning how to use another third-party tool, when
what I want should be included in the IDE?

-- Barry
Paul Wistrand - 26 Oct 2004 13:33 GMT
> I don't perceive NAnt as being part of Visual Studio. That is, I don't
> expect I could depend on it being installed when the project is checked out
> of source control on a new machine.
Interestingly enough most NAnt users (and its Java parent Ant) prefer to use
because of its independence from the IDE. Hence why most open source
projects use it (I see that the ANTLR C# runtime is built using NAnt). NAnt
has becoming ubiquitous enough that MS have decided to clone it for its next
version of VS as MSBuild.

> I'm not sure it gives me any benefits above make; I already know how to use
> make.
Well it ships with an extensive set of predefined tasks beyond what
makefiles offer and provides a framework to develop your own tasks. Many
people also use it because it will execute tasks beyond just the build
process e.g.. deployment, integration. Will it provide the answer to your
particular problem? I have no idea. I only suggested it so that you would
have somewhere to look to try and solve your problem.

> How do I benefit by learning how to use another third-party tool, when
> what I want should be included in the IDE?
There are many things I'd like to see in my expensive IDE as well. Eclipse,
a free IDE,  will have been offering refactoring in the IDE for over two
years before VS 2005 ships. Frustrating but a reality.

In any event I'm not trying to suggest that NAnt is the greatest and best
thing out there just that if you can't get things to work you might want to
take a look at it.

----- Original Message -----
From: "Barry Kelly" <barry.j.kelly.at.gmail.com>
Newsgroups: microsoft.public.vstudio.general
Sent: Tuesday, October 26, 2004 9:24 AM
Subject: Re: Complex build for C# projects with custom tools
Daniel O'Connell [C# MVP] - 26 Oct 2004 09:45 GMT
> I've tried associating a batch file with the project, but there's a
> problem: VS.NET doesn't detect that source code files have changed as a
[quoted text clipped - 7 lines]
> At this stage, I've started using GNU make from the command-line to build
> my project. What can I do to make VS.NET understand my dependencies?

Have you checked in the VS options and ensured that the
Environment->Documents option "Detect when file is changed outside the
environment" is checked?

I use compilation steps like that fairly often and don't really have issues.
Barry Kelly - 26 Oct 2004 15:06 GMT
Aside: If that's your real name, ...

> > I've tried associating a batch file with the project, but there's a
> > problem: VS.NET doesn't detect that source code files have changed as a
[quoted text clipped - 5 lines]
> Environment->Documents option "Detect when file is changed outside the
> environment" is checked?

I do, both the higher level "Detect changes" and the sub-tick "Automatically
load if not changed".

-- Barry Kelly
Daniel O'Connell [C# MVP] - 26 Oct 2004 15:27 GMT
> Aside: If that's your real name, ...

It is, without the [C# MVP] part of course, ;).

What brings that up?

>> > I've tried associating a batch file with the project, but there's a
>> > problem: VS.NET doesn't detect that source code files have changed as a
[quoted text clipped - 8 lines]
> I do, both the higher level "Detect changes" and the sub-tick
> "Automatically load if not changed".

Hmm, that is odd. I was compiling a compiler using a pre-build step before
and that was working ok, and I have one project inwhich I build my files
externally.

How did you associate the bat file?
Barry Kelly - 26 Oct 2004 16:47 GMT
>> Aside: If that's your real name, ...
>
> It is, without the [C# MVP] part of course, ;).
>
> What brings that up?

Well, here in Ireland, it would be a little too grand to be believed. You'd
have been bullied at school for having pompous, hubristic, over-proud
parents :)

>>> > I've tried associating a batch file with the project, but there's a
>>> > problem: VS.NET doesn't detect that source code files have changed as
[quoted text clipped - 15 lines]
>
> How did you associate the bat file?

Project | Properties | Build Events | Pre-build event command line:

 $(ProjectDir)build-grammar.cmd

Contents of build-grammar.cmd:

---8<---
@echo off

rem First, go to the project directory.

cd ../..

rem Next, build the grammar.

antlr pipe-expr.g
antlr type-checker.g
--->8---

On second glance, "../.." looks Unix, but it works perfectly fine.

-- Barry Kelly
Barry Kelly - 26 Oct 2004 17:04 GMT
> ---8<---
> @echo off
[quoted text clipped - 8 lines]
> antlr type-checker.g
> --->8---

Even when I insert commands to delete the generated files (in case ANTLR
does something odd which makes the files look unchanged) before running
ANTLR, it still takes two cycles.

-- Barry Kelly
Barry Kelly - 26 Oct 2004 17:00 GMT
> I've got a slightly complex build process for the project I'm working on.
> [...]
> VS.NET doesn't detect that source code files have changed as a result of
> tool execution and seems to use buffered in-memory versions of old source,
> and so I need to build 2, 3 or more times before I have a debug executable
> which correctly reflects the current state.

It's extremely reproducible right now. Just as I'm typing in this post, any
syntax error requires two builds to show up, and any fix requires two builds
to get the error to go away again.

-- Barry Kelly

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.