Add netstandard2.0 target framework to Microsoft.ApplicationInsights#3142
Merged
rajkumar-rangaraj merged 2 commits intomainfrom Mar 13, 2026
Merged
Add netstandard2.0 target framework to Microsoft.ApplicationInsights#3142rajkumar-rangaraj merged 2 commits intomainfrom
rajkumar-rangaraj merged 2 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reintroduces a netstandard2.0 build target for the Microsoft.ApplicationInsights (BASE) package and updates repository-wide build properties and documentation to reflect the targeting change.
Changes:
- Add
netstandard2.0toMicrosoft.ApplicationInsightsmulti-targeting and adjust related conditional references. - Update build props to recognize
netstandard2.0as part of theIsNetStandard20condition. - Document the change in
CHANGELOG.mdand update target framework breaking-changes notes.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| Directory.Build.props | Updates target-framework classification to include netstandard2.0 in IsNetStandard20. |
| CHANGELOG.md | Adds an Unreleased entry describing the added netstandard2.0 target. |
| BreakingChanges.md | Updates the documented 3.x target frameworks for the NLogTarget section. |
| BASE/src/Microsoft.ApplicationInsights/Microsoft.ApplicationInsights.csproj | Adds netstandard2.0 to TargetFrameworks and updates conditional references accordingly. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Updated the changelog to include a link for the addition of the `netstandard2.0` target framework in the `Microsoft.ApplicationInsights` package.
harsimar
approved these changes
Mar 13, 2026
harsimar
pushed a commit
that referenced
this pull request
Mar 31, 2026
* Fix DisableTelemetry not disabling metrics export OTEL_SDK_DISABLED was set in IConfiguration too late (during AzureMonitorExporterOptions callback) after the OTel MeterProvider had already been constructed and checked the flag. Fix: Register a DisableTelemetryInitializerHostedService at position 0 in the service collection so it runs before OpenTelemetry's TelemetryHostedService, setting OTEL_SDK_DISABLED in IConfiguration before providers are built. Consolidated the registration in the shared AddTelemetryConfigAndClient method so both AspNetCore and WorkerService packages benefit from the fix. * Update CHANGELOG with PR #3156 * Address Copilot review: direct injection + restore CHANGELOG entries - Replace IServiceProvider service locator with direct constructor injection of TelemetryConfiguration and IConfiguration in DisableTelemetryInitializerHostedService (both are singletons). - Restore accidentally dropped CHANGELOG entries for #3153 and #3142. * Fix DisableTelemetry: set OTEL_SDK_DISABLED in TelemetryConfiguration factory The hosted service approach did not work because MeterProvider is resolved during the DI configuration phase (via UseAzureMonitorExporter -> options resolution), before any hosted service runs. Move OTEL_SDK_DISABLED assignment into the TelemetryConfiguration singleton factory so it is set immediately after applying Configure callbacks. Since TelemetryConfiguration is always resolved before MeterProvider, this guarantees the flag is visible when the OTel SDK checks it. Remove DisableTelemetryInitializerHostedService (no longer needed).
This was referenced Apr 2, 2026
Open
Closed
Open
This was referenced Apr 4, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix Issue #3130
Customers with shared libraries targeting
netstandard2.0cannot reference theMicrosoft.ApplicationInsightsNuGet package after the 3.0.0 release removednetstandard2.0. This PR addsnetstandard2.0to the core SDK to restore support for these library authors.At runtime, the host application (targeting net8.0/net9.0/net10.0) resolves the concrete TFM build of the SDK — the
netstandard2.0build is only used at compile time by the shared library. All NuGet dependencies (Azure.Monitor.OpenTelemetry.Exporter1.6.0,OpenTelemetry1.15.0,System.Diagnostics.DiagnosticSource10.0.2) shipnetstandard2.0builds, so no version bifurcation is needed.No source code changes were required — all existing
#ifconditional compilation already hasnetstandard2.0-compatible fallback paths.Changes
BASE/src/Microsoft.ApplicationInsights/Microsoft.ApplicationInsights.csproj— Addednetstandard2.0to<TargetFrameworks>, scopedSystem.Net.Httpreference tonet462only, excludedEventRegisterfornetstandard2.0Directory.Build.props— Addednetstandard2.0toIsNetStandard20conditionCHANGELOG.md— Added entry under UnreleasedBreakingChanges.md— Corrected stale NLog target framework documentationChecklist
For significant contributions please make sure you have completed the following items:
The PR will trigger build, unit tests, and functional tests automatically. Please follow these instructions to build and test locally.
Notes for authors: