-
Notifications
You must be signed in to change notification settings - Fork 4
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
Could not load file or assembly Gu.Roslyn.Extensions #111
Comments
Did this happen after updating? If so it is a bug in nuget.exe paket, handles it well. For current version of this analyzer the project file should have: <Analyzer Include="..\packages\PropertyChangedAnalyzers.2.7.1.0\analyzers\dotnet\cs\Gu.Roslyn.Extensions.dll" />
<Analyzer Include="..\packages\PropertyChangedAnalyzers.2.7.1.0\analyzers\dotnet\cs\PropertyChangedAnalyzers.dll" /> Assuming old .csproj. As you can see I'm not sure there is a good way to pack analyzers with helper libraries. |
I've been thinking about doing whet fody costura does so we can ship the helper lib as a resource in the analyzer. That would avoid bugs like this, chances are it will not work when running in VS. Another alternative could be to IL-merge it. |
No, it didn't happen after an update. This was a clean install on VS2019,
originally with the brand spanking new .NET Framework 4.8, but I retried it
with 4.7.2 after I got these errors, to no avail.
…On Sun, Apr 21, 2019 at 9:15 AM Johan Larsson ***@***.***> wrote:
I've been thinking about doing whet fody costura does so we can ship the
helper lib as a resource in the analyzer. That would avoid bugs like this,
chances are it will not work when running in VS. Another alternative could
be to IL-merge it.
|
I tried installing it in a new project with VS2019 and 4.7.2, no repro, everyhing worked as far as I can tell. |
Is it still an issue? We need to find a way to reproduce and fix it if so. |
Yeah, I still need to nail down a repro. Sorry about that. I will note I also attempted to manually install Gu.Roslyn.Extensions, which ended up polluting my packages directory so badly I decided to create a new project (I have a test solution for experimenting with different analyzers) |
Can it be that you have disabled running powershell scripts in nuget packages? Gu.Roslyn.Extensions is added via install.ps1 when using old csproj. |
I have the same issue, weirdly enough only in my Azure DevOps pipeline CI builds... I believe the issue is solved with this commit GuOrg/Gu.Roslyn.Extensions@78c17df#diff-62a535edf871d30ecbb5443ca2691860 and all that is missing right now is to create a new NuGet package release for |
@bddckr are you using other analyzers that depend on I'll try to find time to make a release tomorrow to see if we can get you unstuck. For the future we are planning: GuOrg/Gu.Roslyn.Extensions#59 |
I just checked and the only easy way for me to tell whether I do is by looking at the analyzer dependencies shown in Visual Studio, as that currently still works until the referenced work in GuOrg/Gu.Roslyn.Extensions#59 is done I suppose. Reading through that issue it sounds like that is actually my issue here, too?
Sadly it's a private project.
Does knowing I have two analyzers reference it (see above) change anything? I double-checked and I can at least say for certain the only logs I get during my builds are because of
Thankfully this wouldn't be an issue for me! 😄 |
Yes, it makes it very likely that a bug in nuget broke things for you when you updated. You want the project file to look like: <Analyzer Include="..\packages\PropertyChangedAnalyzers.2.7.2.0\analyzers\dotnet\cs\Gu.Roslyn.Extensions.dll" />
<Analyzer Include="..\packages\PropertyChangedAnalyzers.2.7.2.0\analyzers\dotnet\cs\PropertyChangedAnalyzers.dll" />
<Analyzer Include="..\packages\IDisposableAnalyzers.2.1.2.0\analyzers\dotnet\cs\Gu.Roslyn.Extensions.dll" />
<Analyzer Include="..\packages\IDisposableAnalyzers.2.1.2.0\analyzers\dotnet\cs\IDisposableAnalyzers.dll" /> When updating nuget removes the first instance it finds of |
Is there a way to check or configure this with the new project file format? I'm using <PackageReference Include="PropertyChangedAnalyzers" Version="2.7.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="IDisposableAnalyzers" Version="2.1.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference> |
I don't know nuget well, have only used paket the last years. |
I don't think so. By design, <Analyzer> and <Reference> elements are managed for you by the .NET SDK. |
You can run |
If you were publishing a nupkg artifact at https://ci.appveyor.com/project/JohanLarsson/gu-roslyn-extensions/builds/26405646/artifacts, @bddckr could test his theory that the master branch is already fixed. |
I can see each package lists ...
"IDisposableAnalyzers/2.1.2": {
"sha512": "hwlTC7QQq3+YY5wr94DETqDgU0sUBDbd0zoxI5hMnePZqooZHAwy3HvRwOmE1jZ4tX+iENBLKyWycKBaIFB2Yw==",
"type": "package",
"path": "idisposableanalyzers/2.1.2",
"hasTools": true,
"files": [
".nupkg.metadata",
".signature.p7s",
"analyzers/dotnet/cs/Gu.Roslyn.Extensions.dll",
"analyzers/dotnet/cs/IDisposableAnalyzers.dll",
"idisposableanalyzers.2.1.2.nupkg.sha512",
"idisposableanalyzers.nuspec",
"tools/install.ps1",
"tools/uninstall.ps1"
]
},
"PropertyChangedAnalyzers/2.7.2": {
"sha512": "14loYCit6A7t5ogmEaVwr6ht2LlZ5oYuaAtW7uNtSc4krAS4Gmn8Vg4+8aMCRG4YT2nSeD6op6HfpGUiEMHM2w==",
"type": "package",
"path": "propertychangedanalyzers/2.7.2",
"hasTools": true,
"files": [
".nupkg.metadata",
".signature.p7s",
"analyzers/dotnet/cs/Gu.Roslyn.Extensions.dll",
"analyzers/dotnet/cs/PropertyChangedAnalyzers.dll",
"propertychangedanalyzers.2.7.2.nupkg.sha512",
"propertychangedanalyzers.nuspec",
"tools/install.ps1",
"tools/uninstall.ps1"
]
},
... The versions of
I think my theory is moot: If I downgrade Here's a minimal project to reproduce the issue: https://github.com/bddckr/AD0001-FileLoadException I noticed if I install the packages via Visual Studio it actually adds Is this a NuGet bug? An MSBuild one? I mean I'd expect each package to be fine coming with its own version of the same |
Awesome research!
We must fix this, quickest way forward is to release new versions of everything that depends on
I created NuGet/Home#8225 and I think another for old csproj. Maybe you can open a new issue with your awesome repro? My guess is that this is a nuget bug. The bug I mentioned was when updating with old csproj, may be due to the same root cause. Shot in the dark for fixing CI: Maybe an explicit |
I'm doing that already before the I'll look at opening an issue on the NuGet repo soon. I'll test with the old csproj first. |
Unless you're doing 'dotnet build --no-restore' in CI, explicit 'dotnet restore' is unnecessary. |
It is necessary as I have a caching setup and I am saving the cached state before it potentially being "polluted" by the build output. With or without I'll check with the old project format, then raise an issue, but in general I think this can be treated as a |
I did not suggest using old csproj, just to be clear. |
Totally clear here, just thinking it's valuable information to pass to the NuGet team when raising a new issue. I'm still trying to figure out why Visual Studio seems to be fine, while |
I attempted installing the package in the error. It did not help. Any ideas?
The text was updated successfully, but these errors were encountered: