LorandBiro/OctoPack.Precompile

Dependent folders' names incorrectly truncated

Opened this issue · 1 comments

We have a solution that contains several different projects. Only one of these projects needs to be precompiled prior to packaging by OctoPack. During the processing carried out by OctoPack.Precompile, a list of NormalizedFiles is created, from the @(CollectedFiles). However, this line in the OctoPack.Precompile.targets file is, I think, inadvertently truncating paths that are outside the project folder heirarchy:

<DestinationPath>$(OctoPackPrecompileIntermediateOutputPath)$([System.String]::Copy('%(FullPath)').Substring($(ProjectDir.Length)))</DestinationPath>

For example, my .csproj is dependent on other projects within our solution, and has project references such as:

    <ProjectReference Include="..\DSSCommon\DSSCommon.csproj">
      <Project>{1606CFDC-D60A-4920-8FEB-E5C09168AA54}</Project>
      <Name>DSSCommon</Name>
    </ProjectReference>

This results in files being copied into a directory such as obj\Release\PrecompiledIntermediate\mmon. I suspect the use of $(ProjectDir.Length) when making a relative path is the cause of this issue.

It's not clear for me how to reproduce this issue.
Linked files should be supported. (You can see that a few lines below the referenced code.) Also there's a simple unit test that checks whether the path is properly determined. Clearly your situation is different than what I prepared for.

Could you create and share a sample repository that I can check?