I think I’ve found a bug with the solution task. I’m not sure this is the proper forum, but here goes anyway.

 

 

It appears references to managed c++ libraries are removed for solution tasks that have the outputdir parameter set.

 

 

 

Here is the setup:

  • Create a VS.Net solution with two projects
    • Managed C++ Library project
    • A C#/VB console project
  • Create a dummy class in the C++ project that contains a public method
  • In the console project add a reference to the C++ project
  • In the console project create an install to the dummy class and call the method.
  • This should all build from VS.NET IDE

 

To get the error:

  • Create a Nant build file with a solution task that builds the above VS.Net solution
  • Set the outputdir parameter to a new location
  • Run the nant build in verbose mode
  • You’ll notice that the /r csc parameter is missing for the c++ library

 

 

I believe I’ve tracked down the cause.

When the c++ project is built, the output is sent to the designated outputdir.  Then when the console project is built it tries to resolve the path to the c++ library in its original location instead of the outputdir location.

 

I’ve made the following change to the ProjectReferenceBase.cs GetAssemblyReferences method. Notice that the projectOutputFile variable has been updated to point to the OutputDir.

 

        public override StringCollection GetAssemblyReferences(string solutionConfiguration) {

            StringCollection assemblyReferences = null;

 

            // check if parent is a VB.NET project

            if (typeof(VBProject).IsAssignableFrom(Parent.GetType())) {

                assemblyReferences = Project.GetAssemblyReferences(solutionConfiguration);

            } else {

                assemblyReferences = new StringCollection();

            }

 

              ConfigurationBase projectConfig = (ConfigurationBase) Project.GetConfiguration(solutionConfiguration);

 

              string outFileprojectConfig.BuildPath;

 

              string projectOutputFile = FileUtils.CombinePaths(projectConfig.OutputDir.FullName,

                   Path.GetFileName(outFile));

 

 

            // check if project has output file

            if (projectOutputFile != null) {

                if (File.Exists(projectOutputFile)) {

                    // add primary output to list of reference assemblies

                    assemblyReferences.Add(projectOutputFile);

                }

            }

 

            // return assembly references

            return assemblyReferences;

        }

 

 

 

 

Thanks,

 

Blair Wall

[EMAIL PROTECTED]

Reply via email to