Share

NAnt - A .NET Build Tool

Tracker: Bugs

5 C++ Solution task does not link against Project Dependencies - ID: 1124296
Last Update: Comment added ( drieseng )

It seems that when building a C++ solution with the
<solution> task, the Project Dependencies are not being
included in the link command. VC++ itself builds the
solution fine, and includes the other project's lib
files in the linker line (if I look at Command Line in
the properties for the executable project)

It looks like someone else had this problem and
provided the appropriate fix here:

http://www.mail-archive.com/nant-developers@lists.sourceforge.net/msg05097.
html

but the part dealing with project dependencies doesn't
seem to have made it into the code.

I get the same results with 0.85 RC2 and with the
latest nightly (2/8/2005).


Scott Hunter ( huntes ) - 2005-02-16 21:34

5

Closed

Fixed

Gert Driesen

Tasks

0.85

Public


Comments ( 3 )

Date: 2005-05-29 16:01
Sender: driesengProject AdminAccepting Donations

Logged In: YES
user_id=707851

This is now fixed in cvs.


Date: 2005-04-10 16:56
Sender: driesengProject AdminAccepting Donations

Logged In: YES
user_id=707851

Can you attach a repro for this issue covering as much
corner cases as possible ?

Thanks !


Date: 2005-03-30 15:48
Sender: henryl

Logged In: YES
user_id=1083163

I've made the following patch. Seems to work for me, but it
will have issues if a dependent project is also added as an
input. Not very tested; I've only used it on the one solution.


diff -u -r src/NAnt.VSNet/ProjectBase.cs
src/NAnt.VSNet/ProjectBase.cs
--- src/NAnt.VSNet/ProjectBase.cs 2005-01-29
15:58:06.000000000 +0000
+++ src/NAnt.VSNet/ProjectBase.cs 2005-03-30
15:52:07.866501100 +0100
@@ -66,6 +66,8 @@
_buildConfigurations =
CollectionsUtil.CreateCaseInsensitiveHashtable();
_extraOutputFiles =
CollectionsUtil.CreateCaseInsensitiveHashtable();

+ _dependencyOutputs = new ArrayList();
+
// ensure the specified project is actually
supported by this project
VerifyProjectXml(xmlDefinition);

@@ -187,6 +189,17 @@
get;
}

+ /// <summary>
+ /// Outputs of upstream dependencies
+ /// </summary>
+ public ArrayList DependencyOutputs
+ {
+ get
+ {
+ return _dependencyOutputs;
+ }
+ }
+
public SolutionTask SolutionTask {
get { return _solutionTask; }
}
@@ -707,6 +720,7 @@
private GacCache _gacCache;
private ReferencesResolver _refResolver;
private Hashtable _extraOutputFiles;
+ private ArrayList _dependencyOutputs;

#endregion Private Instance Fields
}
diff -u -r src/NAnt.VSNet/SolutionBase.cs
src/NAnt.VSNet/SolutionBase.cs
--- src/NAnt.VSNet/SolutionBase.cs 2005-01-31
21:44:08.000000000 +0000
+++ src/NAnt.VSNet/SolutionBase.cs 2005-03-30
16:09:14.952446000 +0100
@@ -447,6 +467,15 @@
}
}
}
+
+ // Add all of the output files of dependencies
as files
+ foreach (ProjectBase project in
_htProjects.Values)
+ {
+ foreach (string dependencyGuid in
GetProjectDependencies(project.Guid))
+ {
+
project.DependencyOutputs.AddRange(GetProjectFromGuid(dependencyGuid).GetOutputFiles(buildConfig).Keys);
+ }
+ }
}

/// <summary>
diff -u -r src/NAnt.VSNet/VcProject.cs
src/NAnt.VSNet/VcProject.cs
--- src/NAnt.VSNet/VcProject.cs 2005-01-31
21:46:20.000000000 +0000
+++ src/NAnt.VSNet/VcProject.cs 2005-03-30
15:54:46.930153700 +0100
@@ -1264,6 +1264,12 @@
}
}

+ // Add all upstream dependency outputs
+ foreach (string dependency in DependencyOutputs)
+ {
+ linkTask.Sources.FileNames.Add(dependency);
+ }
+
foreach (string defaultLib in _defaultLibraries) {
linkTask.Sources.FileNames.Add(defaultLib);
}



Attached File

No Files Currently Attached

Changes ( 4 )

Field Old Value Date By
status_id Open 2005-05-29 16:01 drieseng
resolution_id None 2005-05-29 16:01 drieseng
assigned_to nobody 2005-05-29 16:01 drieseng
close_date - 2005-05-29 16:01 drieseng