NANT, web projects and resource files

H

HaukiDog

Hi,

I am trying to set up my C# web project to be compiled by NANT.
Everything compiles and works fine within the IDE. I have a created a
NANT build file which has a simple project tag, like this:

<?xml version="1.0" ?>
<project name="MyProject" default="build" basedir=".">
<description>The Hello World of build files.</description>
<property name="debug" value="true"/>
<property name="bin_directory" value="bin"/>

<target name="clean" description="remove all generated files">
<delete dir="${bin_directory}" failonerror="true"
verbose="true"/>
</target>

<target name="build" description="compiles the source code"
depends="clean">
<solution configuration="release">
<projects>
<includes name="MyProject.csproj" />
</projects>
</solution>
</target>

</project>

It gives me some errors on the building of resource files. Some work,
and some don't. I have been able to work around some files by just
deleting whatever info was shown in the resource editor. The error are
stuff like:

c:\MyProject\MyPage.aspx.resx
error: Invalid ResX input

I have not changed any of the resource files, they are the ones VS
generates. Does NANT use a different compiler then the IDE, seems so?

Does anyone have any idea what might be wrong.

Thanks!!!
Dave
 
B

bruce barker

it uses the same compilers (vbc.exe and csc.exe) as the ide. look at your
nant config, to see which framework (1.0 or 1.1) nant is building with.
 
M

Michael Hall

One thing you might want to try is to download the NAntContrib add-on's from
nantcontrib.sourceforge.net.

There's a task included called "SLiNgshot" (something like that) that will
parse your Solution file and create a <solution name>.build file for you
when you execute the task. I've used this as a kind of jumpstart for
creating a new build script.

<?xml version="1.0"?>
<project name="SlingShot Example" default="build" basedir=".">
<description>SlingShot Example</description>

<property name="solutionName" value="HelloWorld" readonly="true"/>

<target name="BuildSolution">
<!-- Parse the specified Solution file -->
<!-- Create a Nant build file from that file. -->
<slingshot solution="${solutionName}.sln" format="nant"
output="${solutionName}.build">
<parameters>
<option name="build.basedir" value="..\bin"/>
</parameters>
</slingshot> -->
<!-- Execute the generated build file. -->
<nant buildfile="${solutionName}.build"/>
</target>

</project>

This script will create "HelloWorld.build" based on your solution
"HelloWorld.sln". From there you can examine the generate build script and
alter it as you see fit. If you want to alter the generated script I
recommend removing or commenting out the slingshot task, because the
generated .build file will be overwritten every time the script is executed.

Hope this is helpful!

Michael Hall
(e-mail address removed)
Just3Ws, Inc.
 

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