Nice3point / RevitToolkit

Toolkit for Revit plugin development
MIT License
81 stars 12 forks source link

Add application insights to host logger #8

Closed AmeerMansour closed 3 months ago

AmeerMansour commented 3 months ago

I am trying to add application insights to the host and I get this error not sure what is the issue

image I just added Microsoft.Extensions.Logging.ApplicationInsights package and trying to use it image

AmeerMansour commented 3 months ago

I found the issue that revit uses an older version but shouldn't the assembly resolver handle that? Microsoft.Extensions.Logging these are the modules that loaded in the environment image

Nice3point commented 3 months ago

What version of Revit are you using, 2025 or older?

AmeerMansour commented 3 months ago

2024

Nice3point commented 3 months ago

@AmeerMansour the problem and solutions are described here https://github.com/jeremytammik/RevitLookup/issues/269 you have a plugin with outdated dependencies check the installed plugins to understand which one uses Serilog.dll

AmeerMansour commented 3 months ago

the problem is not in 3rd party the problem is revit itself uses C:\Program Files\Autodesk\Revit 2024\Microsoft.Extensions.Logging.dll version 2.02.0.18315 which doesn't have application insights extension ! so I have to downgrade my Microsoft.Extensions.Logging to the same version .

AmeerMansour commented 3 months ago

if you have revit 2025 installed can you check if they are using Microsoft.Extensions.Logging version 2.02.0.18315 as well ? as they are using it since 2020

Nice3point commented 3 months ago

Yes, indeed older versions of Revit include version 2.2. You can downgrade the Nuget package version for them. The 2025 version includes version 7, but it doesn't matter because the 2025 version has enabled dependency isolation in the Toolkit and you can use Microsoft.Extensions.Logging version 8 with no problem.

AmeerMansour commented 3 months ago

thanks ! it is really awful to be forced to use Microsoft.Extensions.Hosting v2 for older revit versions. you may close this issue if you want