|
Hello all. I’m currently trying to use NAnt as an automated build
tool for a project here at Vanderbilt. The code is in C++ and is modified
through Visual Studio 7.1. We are using the NAnt <solution> task in the NAnt build
file. A problem occurs using the NAnt <solution> task under the
following circumstances: Some of the source files (e.g. *.cpp files) in the project are
not within the project directory structure. Rather, they are part of a
separate package that must already be installed in order to perform the project
build. The location of the package is indicated by an environment variable called
“PKG_ROOT”, which is set to “C:\Path_To_Package”. To include a source file from the this package in the project,
i.e. so that it will be compiled as part of the project, the file’s “Relative
Path”, as set in the file “properties” window of VS, is “$(PKG_ROOT)\path_to_file_from_PKG_ROOT”.
In the .vcproj file, this value shows up in the “RelativePath”
attribute of a “File” element. Note the syntax of the environment variable reference, i.e. $(ENV_VAR).
This syntax is used elsewhere in VS, e.g. in the Tools->Options->Projects->Directories
window for specifying various pertinent directories (e.g. include directories). Unfortunately, when this RelativePath is expanded by NAnt,
it becomes “C:\Build_Directory\$(PKG_ROOT)\path_to_file_from_PKG_ROOT”,
which (obviously) causes the build to fail. The build in VS works fine, leading me to believe that VS: 1. Expands environment variable references ( like $(ENV_VAR)
) in the “RelativePath” attribute before it uses this attribute. 2. When VS notices that the value of the “RelativePath”
attribute is actually an absolute path (e.g. it starts with C:\), it does not
prepend the project directory path onto it. I made a modification to the NAnt code to implement this
functionality. The “diff” file is included as an attachment.
There may be a better means of implementing this, but regardless, it would be
nice to have this functionality in the final 0.85 release. Thanks. -- Harmon |
nant-0.85-rc3.diff
Description: nant-0.85-rc3.diff
