3

An extension of this question, but slightly different, and the accepted answer does not quite work for this situation.

We've got a process in place on the build of our project which is generating some additional files, these files are getting (correctly) generated into the /bin folder as expected. However they are not getting copied across when this project is referenced as a dependency.

Following the above questions accepted answer (with a little bit of tweaking), I managed to get them copying across to the dependant project however they are all getting put into a /bin sub folder of the dependants /bin folder (i.e. /bin/bin), which is not what I need to have happen.

The process we're running is a 3rd party process (specifically Surviveplus.XmlCommentLocalization), so I have no control over that side of it.

I could do something additional on the dependant project to move them out of the /bin/bin into the level up, but I'd rather have the original project work as I'd expect it to.

This is the ItemGroup I'm using, derived from the other question:

<ItemGroup>
  <Content Include="$(OutputPath)\**\*\*.xml">
    <CopyToOutputDirectory>Always</CopyToOutputDirectory>
  </Content>
</ItemGroup>

I've also tried setting specifically the TargetPath value, which while un-documented (or I'm blind to it), seems to exist - as per the msbuild output log

<ItemGroup>
  <Content Include="$(OutputPath)\**\*\*.xml" KeepMetadata="TargetPath">
    <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    <TargetPath>..\</TargetPath>
  </Content>
</ItemGroup>

But it appears that when it comes to the Copy task it just ignores it, and resolves a new TargetPath. I've also tried a myriad of combinations of attributes/item types in that item group (i.e. None, EmbeddedResource) but they didn't solve it either.

Ideally I suppose MSBuild needs to mark the generated files as part of the generated assembly? But after getting lost in .target files and MSDN docs, I couldn't figure it out.

MSBuild being used is version 12.0, compiling for .net4.5.

Community
  • 1
  • 1
Psytronic
  • 6,043
  • 5
  • 37
  • 56
  • 2
    it's amazing no one knows the answer for this one. I'm looking for an answer just like you. – johni Oct 27 '16 at 12:00

0 Answers0