Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ public void E2E_TelemetryFiles_AllWritten()
File.Exists(solutionTargetTelemetryFile).Should().BeTrue();
File.ReadAllLines(solutionTargetTelemetryFile).Should().SatisfyRespectively(
x => x.Should().StartWith("""{"dotnetenterprise.s4net.build.visual_studio_version":"""),
x => x.Should().StartWith("""{"dotnetenterprise.s4net.build.msbuild_tools_version":"""));
x => x.Should().StartWith("""{"dotnetenterprise.s4net.build.msbuild_version":"""));

var projectTelemetryFile = Path.Combine(rootOutputFolder, "0", "Telemetry.json");
File.Exists(projectTelemetryFile).Should().BeTrue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@

<Target Name="WriteSonarTelemetry" Condition ="$(SonarTelemetryFilePath) != ''" BeforeTargets="Build">
<ItemGroup>
<SonarTelemetry Condition="$(VisualStudioVersion) != ''" Include="dotnetenterprise.s4net.build.visual_studio_version" Value="$(VisualStudioVersion)" />
<SonarTelemetry Include="dotnetenterprise.s4net.build.msbuild_tools_version" Value="$(MSBuildToolsVersion)" />
<SonarTelemetry Condition="$(VisualStudioVersion) != ''" Include="dotnetenterprise.s4net.build.visual_studio_version" Value="$(VisualStudioVersion)" /> <!-- https://learn.microsoft.com/en-us/visualstudio/msbuild/common-msbuild-project-properties?view=vs-2022-->
<SonarTelemetry Condition="$(MSBuildVersion) != ''" Include="dotnetenterprise.s4net.build.msbuild_version" Value="$(MSBuildVersion)" /> <!-- Version of MSBuild. Preferred over MSBuildToolsVersion which defaults to just "Current" https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild-reserved-and-well-known-properties?view=vs-2022-->
</ItemGroup>

<WriteSonarTelemetry Filename="$(SonarTelemetryFilePath)" CreateNew="true" Telemetry="@(SonarTelemetry)"/>
Expand Down Expand Up @@ -364,8 +364,6 @@
<SonarReportFilePath Condition= "$(SonarErrorLogExists) == 'true'" Include="$(SonarErrorLog)" />
</ItemGroup>

<WriteSonarTelemetry Filename="$(SonarProjectTelemetryFilePath)" Key="dotnetenterprise.s4net.build.target_framework_moniker" Value="$(TargetFrameworkMoniker)" />

<ItemGroup>
<SonarQubeSetting Include="sonar.$(SQLanguage).roslyn.reportFilePaths" Condition=" @(SonarReportFilePath) != '' ">
<!-- Join the paths with | -->
Expand Down Expand Up @@ -403,6 +401,14 @@
Configuration="$(Configuration)"
Platform="$(Platform)"
TargetFramework="$(TargetFramework)" />

<ItemGroup>
<SonarProjectTelemetry Condition="$(TargetFrameworkMoniker) != ''" Include="dotnetenterprise.s4net.build.target_framework_moniker" Value="$(TargetFrameworkMoniker)" />
<SonarProjectTelemetry Condition="$(UsingMicrosoftNETSdk) != ''" Include="dotnetenterprise.s4net.build.using_microsoft_net_sdk" Value="$(UsingMicrosoftNETSdk)" /> <!-- new SDK style projects https://stackoverflow.com/a/53530363-->
<SonarProjectTelemetry Condition="$(Deterministic) != ''" Include="dotnetenterprise.s4net.build.deterministic" Value="$(Deterministic)" />
<SonarProjectTelemetry Condition="$(NuGetProjectStyle) != ''" Include="dotnetenterprise.s4net.build.nuget_project_style" Value="$(NuGetProjectStyle)" />
</ItemGroup>
<WriteSonarTelemetry Condition="$(SonarProjectTelemetryFilePath)!=''" Filename="$(SonarProjectTelemetryFilePath)" Telemetry="@(SonarProjectTelemetry)" />

<Message Importance="high" Text="Sonar: ($(MSBuildProjectFile)) Project processed successfully" />
</Target>
Expand Down
Loading