Home > Archive > Visual Studio > October 2004 > Complex build for C# projects with custom tools
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Complex build for C# projects with custom tools
|
|
| Barry Kelly 2004-10-20, 8:57 am |
| 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 2004-10-22, 8:56 am |
| Have you not tried NAnt?
"Barry Kelly" <barry.j.kelly.at.gmail.com> wrote in message
news:egSH8cptEHA.2128@TK2MSFTNGP11.phx.gbl...
> 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
>
>
| |
| Barry Kelly 2004-10-26, 9:00 am |
| > "Barry Kelly" <barry.j.kelly.at.gmail.com> wrote in message
> news:egSH8cptEHA.2128@TK2MSFTNGP11.phx.gbl...
>
>
"Paul Wistrand" <pwistrand@hotmail.com> wrote in message
news:%23eb$TrBuEHA.1308@tk2msftngp13.phx.gbl...
>
> 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
| |
| Daniel O'Connell [C# MVP] 2004-10-26, 9:00 am |
|
"Barry Kelly" <barry.j.kelly.at.gmail.com> wrote in message
news:egSH8cptEHA.2128@TK2MSFTNGP11.phx.gbl...
> 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?
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.
| |
| Paul Wistrand 2004-10-26, 9:00 am |
| > 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
| |
| Barry Kelly 2004-10-26, 3:58 pm |
| "Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in
message news:OmaYagzuEHA.2684@TK2MSFTNGP12.phx.gbl...
Aside: If that's your real name, ...
> "Barry Kelly" <barry.j.kelly.at.gmail.com> wrote in message
> news:egSH8cptEHA.2128@TK2MSFTNGP11.phx.gbl...
>
> 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 do, both the higher level "Detect changes" and the sub-tick "Automatically
load if not changed".
-- Barry Kelly
| |
| Daniel O'Connell [C# MVP] 2004-10-26, 3:58 pm |
|
"Barry Kelly" <barry.j.kelly.at.gmail.com> wrote in message
news:udbjKU2uEHA.1264@TK2MSFTNGP12.phx.gbl...
> "Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in
> message news:OmaYagzuEHA.2684@TK2MSFTNGP12.phx.gbl...
>
> Aside: If that's your real name, ...
It is, without the [C# MVP] part of course, ;).
What brings that up?
>
>
> 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 2004-10-26, 3:58 pm |
|
"Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in
message news:Oa5fzf2uEHA.3808@TK2MSFTNGP15.phx.gbl...
>
> "Barry Kelly" <barry.j.kelly.at.gmail.com> wrote in message
> news:udbjKU2uEHA.1264@TK2MSFTNGP12.phx.gbl...
>
> 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 :)
>
> 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?
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 2004-10-26, 3:58 pm |
| "Barry Kelly" <barry.j.kelly.at.gmail.com> wrote in message
news:egSH8cptEHA.2128@TK2MSFTNGP11.phx.gbl...
> 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
| |
| Barry Kelly 2004-10-26, 3:58 pm |
|
"Barry Kelly" <barry.j.kelly.at.gmail.com> wrote in message
news:%23M6tRM3uEHA.1564@TK2MSFTNGP09.phx.gbl...
> ---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---
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
|
|
|
|
|