roslyn-sdk
roslyn-sdk copied to clipboard
DebugRoslynComponent cannot read config from csproj
Version Used:
Steps to Reproduce:
- 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>
- Observe context.AnalyzerConfigOptionsProvider
- 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
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"/>