SonarScanner for MSBuild 5.4.1
While running in a docker linux image with it
Utilizing generator logging found sonar resources were pulled in instead
/var/lib/jenkins/workspace/ci_cd_ae-project_PR-9/.sonarqube/conf/cs/SonarLint.xml <?xml version="1.0" encoding="UTF-8"?>
/var/lib/jenkins/workspace/ci_cd_ae-project_PR-9/.sonarqube/conf/30/SonarProjectConfig.xml <?xml version="1.0" encoding="utf-8"?>
/var/lib/jenkins/workspace/ci_cd_ae-project_PR-9/.sonarqube/conf/30/ProjectOutFolderPath.txt /var/lib/jenkins/workspace/ci_cd_ae-project_PR-9/.sonarqube/out/30
Locally it seems these files are just additional and you can just filter them out in the generator but unfortunately that is not working via the docker image
- steps to reproduce
Create a basic incremental source generator utilizing the AdditionalTextsProvider IncrementalValuesProvider
The project using the incremental source generator needs to have the following in the csproj file
<PropertyGroup><AdditionalFileItemNames>$(AdditionalFileItemNames);EmbeddedResource</AdditionalFileItemNames>
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="..\*.json" Visible="false" />
</ItemGroup>
Caveat The files are expected to be outside of the project being built folder structure →
Project.Models/jsonFiles/several files
Project.Console → Being built and will use the files from the models project
- potential workaround
None as far as I can tell and hoping someone has a work around.
There is a work around, have two separate sets of code for reading files needed like the json in my case. So I check if we have the expected AdditionalText files otherwise we get the expected directory and read the files via File.ReadAllText