mhutch / MonoDevelop.MSBuildEditor

Improved MSBuild editing support
Other
228 stars 26 forks source link

Item types defined via OutputItemType on ProjectReference are reported as not having a value assigned #243

Closed DamianEdwards closed 2 months ago

DamianEdwards commented 3 months ago

Consider the following in a .csproj file:

<ItemGroup>
  <!-- Reference the analyzer to ensure it's built but don't reference its output -->
  <ProjectReference Include="..\MyCoolLibrary\MyCoolLibrary.Analyzers.csproj" OutputItemType="AnalyzerAssemblyPath" ReferenceOutputAssembly="false" Private="true" />
</ItemGroup>

<Target Name="IncludeAnalyzerInPackage" AfterTargets="ResolveProjectReferences">
  <ItemGroup>
    <None Include="@(AnalyzerAssemblyPath -> '%(Identity)')" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
  </ItemGroup>
</Target>

The OutputItemType attribute on the ProjectReference is specifying that the output of the ProjectReference should be captured in a new item type named AanalyzerAssemblyPath, which is then referenced in the target that's defined, but the editor says the AnalyzerAssemblyPath has no value assigned:

image