#570 Solution task doesn’t handle project dependencies properly

0.85
closed-fixed
Tasks (408)
5
2006-08-06
2006-08-04
asherf
No

Solution task doesn’t handle project dependencies
properly when working with enterprise templates (etp).
When a solution files points to a ETP project and the
project section contains dependencies they are not
handles properly by the solution task.
I am working with the latest nightly build (2006-07-23)

The bug is in NAnt.VSNet\Everett\Solution.cs:

// set-up project dependencies
Regex reDependencies = new
Regex(@"^\s+(?<guid>\{[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}\})\s+=\s+(?<dep>\{[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}\})",
RegexOptions.Multiline);
MatchCollection dependencyMatches =
reDependencies.Matches(projectMatch.Value);

foreach (Match dependencyMatch in
dependencyMatches) {
string dependency =
dependencyMatch.Groups["dep"].Value;

if
(!explicitProjectDependencies.ContainsKey(guid)) {

explicitProjectDependencies[guid] =
CollectionsUtil.CreateCaseInsensitiveHashtable();
}
((Hashtable)
explicitProjectDependencies[guid])[dependency] = null;
}

As you can see the code doesn’t actually extracts the
GUID from the string (using regex). The guid variable
in the loop contains the guid from the outer scope,
which is the guid of the ETP project.

Fixed code:
Regex reDependencies = new
Regex(@"^\s+(?<guid>\{[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}\})\s+=\s+(?<dep>\{[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}\})",
RegexOptions.Multiline);
MatchCollection dependencyMatches =
reDependencies.Matches(projectMatch.Value);

foreach (Match dependencyMatch in
dependencyMatches) {
string dependency =
dependencyMatch.Groups["dep"].Value;
string projGuide = dependencyMatch.Groups["guid"].Value;

if
(!explicitProjectDependencies.ContainsKey(projGuide)) {

explicitProjectDependencies[projGuide] =
CollectionsUtil.CreateCaseInsensitiveHashtable();
}
((Hashtable)
explicitProjectDependencies[projGuide])[dependency] = null;
}

That’s all.

Discussion

  • asherf

    asherf - 2006-08-05

    Logged In: YES
    user_id=1569013

    I made a small mistake in my suggested fix.
    it should use the guid from the regex result only if the
    current project is an ETP:
    string projGuid = guid;
    if (isEnterpriseTemplate) //this question is asked a few
    lines //earlier, the result can be saved for this question
    { projGuid = dependencyMatch.Groups["guid"].Value;}

     
  • Gert Driesen

    Gert Driesen - 2006-08-05

    Logged In: YES
    user_id=707851

    Can you attach a small repro to this report ?

     
  • Gert Driesen

    Gert Driesen - 2006-08-05
    • assigned_to: nobody --> drieseng
     
  • asherf

    asherf - 2006-08-05

    contains two ETPs with a project in each one, look at the sln file to see that the frist proj depends on the second one

     
  • asherf

    asherf - 2006-08-05

    Logged In: YES
    user_id=1569013

    another thing I encountered is something that looks like a
    bug in vs.net 2003. it doesn't handle project depenencies
    for projects inside ETPs.

    http://dotnet247.com/247reference/msgs/42/213100.aspx

    I am working on uploading/contibuting a patch.

     
  • asherf

    asherf - 2006-08-05

    screen shot of the repo (and the fixed version working).

     
  • asherf

    asherf - 2006-08-05

    Logged In: YES
    user_id=1569013

    attached patch

     
  • Gert Driesen

    Gert Driesen - 2006-08-06

    Logged In: YES
    user_id=707851

    Thanks for the patch and the repro, but you don't happen
    to have VS.NET 2002 lying around to also make a repro for
    that version of VS ?

    I wanna make sure we don't need to fix that one too.

     
  • asherf

    asherf - 2006-08-06

    Logged In: YES
    user_id=1569013

    I probably have a copy of VS.NET 2002 somewhere.
    However I don't have it installed.
    I'll try to find some time during the week to install it
    and produce the repo with it.

    BTW, here is an official link to the bug with ETPs in VS
    2003.
    http://support.microsoft.com/kb/818452/en-us

     
  • Gert Driesen

    Gert Driesen - 2006-08-06

    Logged In: YES
    user_id=707851

    This issue is now fixed in CVS for Visual Studio .NET 2003
    solutions.

    Please reopen this bug report if you notice a similar
    issue for Visual Studio .NET 2002 solutions.

     
  • Gert Driesen

    Gert Driesen - 2006-08-06
    • status: open --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks