Skip to content

Commit

Permalink
Fix bogus metadata included in generated items - Close #6 #7
Browse files Browse the repository at this point in the history
  • Loading branch information
pepone committed Jan 15, 2021
1 parent aec00b7 commit 35c3c0e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
11 changes: 10 additions & 1 deletion msbuild/zeroc.icebuilder.msbuild.cpp.targets
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,18 @@
running the SliceCompile target so that the Visual Studio extension has a chance to add the items to the project in
a persistent way. If the extension is not enabled or we are building from the command line we just add the
missing items in a transient way.
First create a property `_SliceCompileGeneratedItems` to hold the paths of all generated items, then we
create a ItemGroup to add a ClCompile item for each generated item that is not part of the project. Using an
intermediate property for the ClCompile Include avoids _SliceCompile item metadata being copied to the
generated ClCompile item.
-->
<CreateProperty Value="$([System.IO.Path]::GetFullPath('%(_SliceCompile.OutputDir)\%(_SliceCompile.Filename).%(_SliceCompile.SourceExt)'))">
<Output TaskParameter="Value" PropertyName="_SliceCompileGeneratedItems" />
</CreateProperty>

<ItemGroup>
<ClCompile Include="@(_SliceCompile->'%(OutputDir)\%(Filename).%(SourceExt)')"
<ClCompile Include="$(_SliceCompileGeneratedItems)"
Exclude="@(ClCompile->'%(FullPath)');@(ClCompile->'%(Identity)')" />
</ItemGroup>

Expand Down
12 changes: 11 additions & 1 deletion msbuild/zeroc.icebuilder.msbuild.csharp.targets
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,19 @@
running the SliceCompile target so that the Visual Studio extension has a chance to add these items to the project in
a persistent way. If the extension is not enabled or we are building from the command line we just add the
missing items in a transient way.
First create a property `_SliceCompileGeneratedItems` to hold the paths of all generated items, then we
create a ItemGroup to add a Compile item for each generated item that is not part of the project. Using an
intermediate property for the Compile Include avoids _SliceCompile item metadata being copied to the
generated Compile item.
-->

<CreateProperty Value="$([System.IO.Path]::GetFullPath('%(_SliceCompile.OutputDir)\%(_SliceCompile.Filename).cs'))">
<Output TaskParameter="Value" PropertyName="_SliceCompileGeneratedItems" />
</CreateProperty>

<ItemGroup>
<Compile Include="@(_SliceCompile->'%(OutputDir)\%(Filename).cs')"
<Compile Include="$(_SliceCompileGeneratedItems)"
Exclude="@(Compile->'%(FullPath)');@(Compile->'%(Identity)')" />
</ItemGroup>
</Target>
Expand Down

0 comments on commit 35c3c0e

Please sign in to comment.