Share

NAnt - A .NET Build Tool

Tracker: Bugs

5 Solution task doesn't do COM, OCX apps built in VC++ - ID: 1078641
Last Update: Comment added ( drieseng )

The solution task for VC++ apps, doesn't call the MIDL
task to compile IDL files.

In this way, you cannot build COM or OCX outputs using
NAnt's solution task.

The output of the MIDL is needed by the resource
compiler when compiling the resource file. Refere to (Bug
ID 1077712) for a fix to the resource problem.


Hani Atassi ( haniatassi ) - 2004-12-03 21:56

5

Closed

Fixed

Gert Driesen

Tasks

0.85

Public


Comments ( 5 )

Date: 2004-12-08 20:53
Sender: driesengProject AdminAccepting Donations

Logged In: YES
user_id=707851

I committed your patch to cvs.

Again, thanks for the contributions and the sample app !


Date: 2004-12-08 15:05
Sender: haniatassiAccepting Donations

Logged In: YES
user_id=590187

Yes there shouldn't be an "else" there.

I just added "/out" to make sure if midl generates any other
files, they would go to the out folder.

Also, I did a test with (outfolder) similar to this ($(SolutionDir)
\Test) and the Type library file ($(IntDir)/
$(ProjectName).tlb).. From the Visual Studio build i got the
the tlb file inside the folder:
$(SolutionDir)\Test\Release\$(ProjectName).tlb

So, inorder to copy the same behaviour, u need to change
the code to something like this: (intermediateDir is using the
outputDirectory instead of the project directory).

string outputDirectory = fileConfig.GetToolSetting
(compilerTool, "OutputDirectory");
if (StringUtils.IsNullOrEmpty(outputDirectory)) {
outputDirectory = fileConfig.ProjectDir.FullName;
}

midlTask.Arguments.Add(new Argument("/out"));
midlTask.Arguments.Add(new Argument
(outputDirectory));

string intermediateDir = Path.Combine
(outputDirectory,
fileConfig.IntermediateDir);


Date: 2004-12-08 08:10
Sender: driesengProject AdminAccepting Donations

Logged In: YES
user_id=707851

In your last change, shouldn't this :

string outputDirectory = fileConfig.GetToolSetting
(compilerTool, "OutputDirectory");
if (StringUtils.IsNullOrEmpty(outputDirectory)) {
outputDirectory = fileConfig.ProjectDir.FullName;
} else {
midlTask.Arguments.Add(new Argument("/out"));
midlTask.Arguments.Add(new Argument
(outputDirectory));
}

be changed into this :

string outputDirectory = fileConfig.GetToolSetting
(compilerTool, "OutputDirectory");
if (StringUtils.IsNullOrEmpty(outputDirectory)) {
outputDirectory = fileConfig.ProjectDir.FullName;
}

midlTask.Arguments.Add(new Argument("/out"));
midlTask.Arguments.Add(new Argument
(outputDirectory));
}

Well, perhaps its not even necessary specifiy the "/out
<directory>" argument as "we" always specifiy absolute
filenames for the individual output files.



Date: 2004-12-07 16:36
Sender: haniatassiAccepting Donations

Logged In: YES
user_id=590187

Found some problems with the function BuildIDLFiles
that is included with the previous file.

I added comments on the logic..


Date: 2004-12-06 23:03
Sender: haniatassiAccepting Donations

Logged In: YES
user_id=590187

Ok... There is actually quite a bit of changes to let the
solution task compile COM and OCX project:

1- The solution task doesn't support MIDL, so I had to
add code to call the MIDL task from the solution task.
2- If the output is OCX, the function IsOutputDll returns
false, eventhough the OCX file is acually a DLL file. So,
it should be changed to return true.
3- If the COM is built using MFC or DLL, you need to use
the fix in bug ID 1078636.
4- Had to add a new function CreateMidlArgumentMap()
to support mapping arguments of MIDL tool.
5- Dlldata inside MidlTask is declared as string. If it's a
file, why it's not of type FileInfo!.
6- I added a new child for the MidlTask and called it
Undefines.

After the previous changes, the solution task worked
perfectly and I could compile my old OCX projects that I
built using MFC. The only wierd thing is that, some of
the regular output messages from the MIDL tool are
treated as Warnings...

Attached are the changes...

Hope this helps..


Attached Files ( 2 )

Filename Description Download
FixesForVC_COM.zip Includes a sample of the bug and a proposed fix. Download
VcProject.cs Some fixes to the function BuildIDLFiles Download

Changes ( 6 )

Field Old Value Date By
status_id Open 2004-12-08 20:53 drieseng
resolution_id None 2004-12-08 20:53 drieseng
assigned_to nobody 2004-12-08 20:53 drieseng
close_date - 2004-12-08 20:53 drieseng
File Added 111583: VcProject.cs 2004-12-07 16:36 haniatassi
File Added 111509: FixesForVC_COM.zip 2004-12-06 23:03 haniatassi