project-system: Compile link include in external msbuild file not displayed in Solution explorer, VS2017
I have a project defined in my \src\Fx.Common\Fx.Common.csproj
path:
<Project Sdk="Microsoft.NET.Sdk" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\SharedProperties.props" />
<PropertyGroup Label="Configuration">
<RootNamespace>Fx</RootNamespace>
</PropertyGroup>
<PropertyGroup>
<Description>Common and utility services used for all V4-powered applications and libraries</Description>
<Copyright>Fresh Egg Limited</Copyright>
<AssemblyTitle>FX: Common Services</AssemblyTitle>
<TargetFramework>netstandard1.6</TargetFramework>
<AssemblyName>Fx.Common</AssemblyName>
</PropertyGroup>
<ItemGroup>
<Compile Include="**\*.cs" />
<EmbeddedResource Include="**\*.resx" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="NETStandard.Library" Version="1.6.1" />
</ItemGroup>
</Project>
In the root of my solution, alongside the solution folder, I have \SharedVersionInfo.cs
which is generated as part of a Cake build for CI. Additionally, I’ve defined a \SharedProperties.props
file at the root:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
<GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute>
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)SharedVersionInfo.cs">
<Link>Properties\SharedVersionInfo.cs</Link>
</Compile>
</ItemGroup>
</Project>
This is referenced by my project Fx.Common
, but the Link
element at Properties\SharedVersionInfo.cs
is not displayed in Solution Explorer. I’ve tried without Link
and it still does not display in Solution Explorer.
The project builds just fine though and carries the expected version information in its metadata.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 4
- Comments: 15 (7 by maintainers)
@kg This is just how the legacy project system has behaved since 2005, it’s only ever showed items that are listed in the project itself. It also doesn’t handle globs (*.fx) very well, and will expand them every chance it has. We consider the legacy project-system done, and we won’t be making changes in this area.
The new project-system (this repo) does support items coming from props/targets and supports globs. However, it won’t show items from outside of the project code, unless they are marked with the Link metadata.