Visual Studio resolve failure #966
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
It works fine when I run
dotnet buildon command line, but when I build in Visual Studio 2022, I get this error. I can't figure out why.Code
If I add a check for "System.Runtime" in the custom assembly resolver to do the same thing as "netstandard", and whether or not I include "mscorlib", I still get an error only in VS.
I don't actually care about any types from runtime assemblies, so my fix was to just do this.
Though it's obviously not a general solution.
Skipping resolving runtime assemblies ended up causing errors when a type from a runtime assembly is used in the target assembly. Any other workarounds or fixes?
Are you using
typeof()anywhere to refer to types you are working with? Because that may cause references to your build context's runtime.Unless that's changed in VS2026, Visual Studio runs
msbuild(.NET Framework), notdotnet build.So if you have code that creates type references based on actual types in your code, you are likely to create references to, say,
System.Int32inSystem.Runtime, but then running that IL under .NET framework will fail (because it would need a reference toSystem.Int32in mscorlib.