roslyn-sdk icon indicating copy to clipboard operation
roslyn-sdk copied to clipboard

DebugRoslynComponent cannot read config from csproj

Open davhdavh opened this issue 2 years ago • 2 comments

Version Used:

Steps to Reproduce:

  1. setup launchprofile:
{
	"profiles": {
		"Debug": {
			"commandName": "DebugRoslynComponent",
			"targetProject": "..\\generator.Tests\\generator.Tests.csproj"
		}
	}
}

in generator.Tests.csproj, reference the generator:

	<ItemGroup>
		<ProjectReference Include="..\generator\generator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="true" />
	</ItemGroup>
  1. Observe context.AnalyzerConfigOptionsProvider
  2. Start Debug

Expected Behavior: Global options contains normal expected keys File specific options contains keys specified in the csproj file.

Actual Behavior: .GlobalOptions.TryGetValue("build_property.MSBuildProjectFullPath", ...) is always not set .fileoptions.TryGetValue("build_property.anything", ...) never has any of the keys set in the generator.Tests.csproj

davhdavh avatar Feb 04 '22 15:02 davhdavh

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

I found the solution also, and this seems to be a doc problem rather than a bug.

You ALSO need to reference the .props file directly in your tests project. <Import Project="../generator/build/generator.props"/>

davhdavh avatar Feb 04 '22 15:02 davhdavh