Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ParseProject fails on an aboslute HintPath #2498

Closed
veselfil opened this issue Mar 13, 2019 · 2 comments
Closed

ParseProject fails on an aboslute HintPath #2498

veselfil opened this issue Mar 13, 2019 · 2 comments
Labels
Bug
Milestone

Comments

@veselfil
Copy link

@veselfil veselfil commented Mar 13, 2019

What You Are Seeing?

When attempting to parse a .csproj file which contains an absolute HintPath, Cake exits with the following exception: Cannot combine a directory path with an absolute file path.

What is Expected?

The project should be parsed successfully, never had any issues with it in Visual Studio.

What version of Cake are you using?

0.32.1, also tried with 0.30.0.

Are you running on a 32 or 64 bit system?

64-bit.

What environment are you running on? Windows? Linux? Mac?

Windows 10 Pro, all updates installed.

Are you running on a CI Server? If so, which one?

No.

How Did You Get This To Happen? (Steps to Reproduce)

I'm not sure what you have to do to add a HintPath, but the library that did it for me is DotNetBar. I'm not the original author of the project, and he's not around anymore, so I cannot really give you more details as how it was added.

Here's a snippet from one of the failing projects:

<Reference Include="DevComponents.DotNetBar2 ...">
    <SpecificVersion>False</SpecificVersion>
    <HintPath>C:\Program Files (x86)\DotNetBar for Windows Forms\Signed\DevComponents.DotNetBar2.dll</HintPath>
</Reference>

Commenting out the HintPath line fixes the issue.

Output Log

Here's the stack trace:

System.InvalidOperationException: Cannot combine a directory path with an absolute file path.
   v Cake.Core.IO.DirectoryPath.CombineWithFilePath(FilePath path)
   v Cake.Common.Solution.Project.ProjectParser.<>c__DisplayClass3_0.<Parse>b__32(<>f__AnonymousType16`2 <>h__TransparentIdentifier9)
   v System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   v System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   v System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   v Cake.Common.Solution.Project.ProjectParser.Parse(FilePath projectPath)
   v Submission#0.ParseProject(FilePath projectPath)
   v Submission#0.<<Initialize>>b__0_5()
@veselfil veselfil changed the title ParseProject fails on an aboslute reference HintPath ParseProject fails on an aboslute HintPath Mar 13, 2019
@gjonespf

This comment has been minimized.

Copy link

@gjonespf gjonespf commented Apr 15, 2019

Had same on a project that added a reference to System.Management.Automation (needed for PowerShell automation). Item group in the project looks like following:

  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Configuration.Install" />
    <Reference Include="System.Core" />
    <Reference Include="System.Management.Automation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>C:\Program Files (x86)\Reference Assemblies\Microsoft\WindowsPowerShell\v1.0\System.Management.Automation.dll</HintPath>
    </Reference>
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
  </ItemGroup>

Removing the hint path node allows the project to be parsed.

agc93 added a commit to agc93/cake that referenced this issue Oct 26, 2019
When parsing HintPath values, "rooted" path values will be preserved.
Relative path values will still be "rooted" to current dir.
@devlead devlead added the Bug label Oct 26, 2019
@devlead devlead added this to the v0.36.0 milestone Oct 26, 2019
agc93 added a commit to agc93/cake that referenced this issue Oct 26, 2019
When parsing HintPath values, "rooted" path values will be preserved.
Relative path values will still be "rooted" to current dir.
devlead added a commit that referenced this issue Oct 26, 2019
@devlead

This comment has been minimized.

Copy link
Member

@devlead devlead commented Oct 26, 2019

Fixed by #2649

@devlead devlead closed this Oct 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.