-
Notifications
You must be signed in to change notification settings - Fork 849
Fix CS0757 error when multi-targeting with Microsoft.Extensions.Telemetry.Abstractions #7062
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Copilot
wants to merge
8
commits into
main
Choose a base branch
from
copilot/fix-telemetry-abstractions-issue
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b8badfc
Initial plan
Copilot 66c5eb2
Add buildTransitive files for net9.0 and net10.0
Copilot 1a3aa11
Rename MSBuild targets to avoid conflict with Microsoft.Extensions.Lo…
Copilot dec1fad
Remove redundant net9.0 and net10.0 buildTransitive folders
Copilot 25054c3
Use generic buildTransitive files for all TFMs
Copilot a00b32e
Merge branch 'main' into copilot/fix-telemetry-abstractions-issue
evgenyfedorov2 99a4472
Remove extra property
evgenyfedorov2 d864ca3
Restore framework-specific buildTransitive folders and add net9.0
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
6 changes: 6 additions & 0 deletions
6
...try.Abstractions/buildTransitive/net9.0/Microsoft.Extensions.Telemetry.Abstractions.props
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| <!-- This package should replace the Microsoft.Extensions.Logging.Abstractions source generator, so we set the property to remove the source generator from the project. --> | ||
| <PropertyGroup> | ||
| <DisableMicrosoftExtensionsLoggingSourceGenerator>true</DisableMicrosoftExtensionsLoggingSourceGenerator> | ||
| </PropertyGroup> | ||
| </Project> | ||
36 changes: 36 additions & 0 deletions
36
...y.Abstractions/buildTransitive/net9.0/Microsoft.Extensions.Telemetry.Abstractions.targets
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| <Project> | ||
| <!-- This package should replace the "Microsoft.Extensions.Logging.Abstractions" source generator. --> | ||
| <Target Name="_Microsoft_Extensions_Telemetry_AbstractionsRemoveAnalyzers" | ||
| Condition="'$(DisableMicrosoftExtensionsLoggingSourceGenerator)' == 'true'" | ||
| AfterTargets="ResolveReferences"> | ||
| <ItemGroup> | ||
| <_Microsoft_Extensions_Logging_AbstractionsAnalyzer | ||
| Include="@(Analyzer)" | ||
| Condition="'%(Analyzer.AssemblyName)' == 'Microsoft.Extensions.Logging.Generators' Or | ||
| '%(Analyzer.NuGetPackageId)' == 'Microsoft.Extensions.Logging.Abstractions'" /> | ||
| </ItemGroup> | ||
|
|
||
| <!-- Remove Microsoft.Extensions.Logging.Abstractions Analyzer --> | ||
| <ItemGroup> | ||
| <Analyzer Remove="@(_Microsoft_Extensions_Logging_AbstractionsAnalyzer)" /> | ||
| </ItemGroup> | ||
| </Target> | ||
|
|
||
| <!-- We have a WPF-specific target because WPF projects generate and compile a temporary project (via "GenerateTemporaryTargetAssembly" target), | ||
| and that temp project doesn't have "ResolveReferences" target we expect. | ||
| This leads to the runtime's generator not being removed and to a compile-time error CS0757. This additional target resolves the problem. --> | ||
| <Target Name="_Microsoft_Extensions_Telemetry_AbstractionsRemoveAnalyzersWPF" | ||
| Condition="'$(DisableMicrosoftExtensionsLoggingSourceGenerator)' == 'true'" | ||
| AfterTargets="RemoveDuplicateAnalyzers"> | ||
| <ItemGroup> | ||
| <_Microsoft_Extensions_Logging_AbstractionsAnalyzerWPF | ||
| Include="@(Analyzer)" | ||
| Condition="'%(Analyzer.AssemblyName)' == 'Microsoft.Extensions.Logging.Generators' Or | ||
| '%(Analyzer.NuGetPackageId)' == 'Microsoft.Extensions.Logging.Abstractions'" /> | ||
| </ItemGroup> | ||
| <!-- Remove Microsoft.Extensions.Logging.Abstractions Analyzer for WPF projects --> | ||
| <ItemGroup> | ||
| <Analyzer Remove="@(_Microsoft_Extensions_Logging_AbstractionsAnalyzerWPF)" /> | ||
| </ItemGroup> | ||
| </Target> | ||
| </Project> |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.