NN_
NN_

Reputation: 1593

VisualStudio ignores last folder in csproj

Why last folder before $(FileName), e.g. "dummy removed by MSBuild" is totally ignored by Visual Studio when displaying files ?

  <ItemGroup>
    <!-- Protobuf files for ReSharper -->
    <Content Include="$(SolutionDir)packages\Google.Protobuf.Tools.*\tools\google\protobuf\**\*.proto">
      <Link>google\protobuf\dummy removed by MSBuild\$(FileName)</Link>
    </Content>
  </ItemGroup>

Upvotes: 1

Views: 49

Answers (1)

Leo Liu
Leo Liu

Reputation: 76870

Why last folder before $(FileName), e.g. "dummy removed by MSBuild" is totally ignored by Visual Studio when displaying files ?

Bold guess, you want to use $(FileName) to get the file name of those .proto files.

To accomplish this, you should use %(Content.Filename) instead of $(FileName), so the code looks like:

  <ItemGroup>
    <Content Include="$(SolutionDir)packages\Google.Protobuf.Tools.*\tools\google\protobuf\**\*.proto">
      <Link>google\protobuf\dummy removed by MSBuild\%(Content.Filename)</Link>
    </Content>
  </ItemGroup>

With above code, those .proto files are display in the solution explorer under the dummy removed by MSBuild folder:

enter image description here

Hope this helps.

Upvotes: 2

Related Questions