O'Reilly logo

C# Essentials by Peter Drayton, Ben Albahari, Brad Merrill

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using nmake

You can use nmake to automate many tasks that build assemblies and modules. Here’s an example that shows many of the previous command lines, in a cohesive manner. Particular nmake features to note are the use of the .SUFFIXES keyword to add a definition for the .cs file extension and the use of the response file with the C# compiler, for when more source-file names are being supplied that can be listed on the command line.

REF=/r:c.dll
DEBUG=/debug
.SUFFIXES: .exe .dll .cs
.cs.dll:
	csc /t:module $*.cs
.cs.exe:
	csc $(DEBUG) $(REF) @<<big.tmp
$*.cs $(SRCLIST)
<<
all : d.exe f.exe
d.exe : d.cs c.dll
c.dll : a.dll b.dll
	al /out:c.dll a.dll b.dll
b.dll : b.cs
a.dll : a.cs
key.snk :
	sn -k $*.snk
e.dll : a.dll b.dll key.snk
	al /out:$*.dll /keyfile:key.snk a.dll b.dll
	al /i:$*.dll
f.exe : f.cs e.dll
	csc $(DEBUG) /r:.\e.dll f.cs
clean:
	del a.dll b.dll c.dll d.exe /q

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required