Hi !
For my company’s need, we need to have our revit plugin compatible with Revit 2023 and Revit 2025. When I run it with Revit 2025 everything works like a charm however, when I try to run it with Revit 2023 I have the ‘System.Resources.Extensions’ not found error. Here’s everything I’ve tried so far
- Add an assembly redirect from version 4.0.0.0 to my version like here
- manually add the System.Resources.Extensions.dll in the Revit2023 folder where there are all DLL but it gives me another error that it can be loaded through reflection mode only
- manually add it in the plugin folder beside the plugin dll
- I of course added the System.Resources.Extensions to my project through NuGetPackage manager
I’m running out of ideas and I almost browsed all web pages. Does anyone already ran into this issue please ?
btw: I’m compiling my project with .Net 4.8
regards !
Solved! Go to Solution.
Solved by benjamin_decreusefond. Go to Solution.
I have the exact same issue with Inventor 2022. Also I have tried the approaches you mentioned, but no luck.
Thanks,
-Thilak Rao
I managed to find out a solution !
Here's the step I followed:
- Remove System.Resources.Extensions from my project and manually add it as Reference from my local after downloading it
Added this code that allows me to load the DLL from its path
public class AssemblyResolver
{
public static void RegisterAssemblyResolver(string baseDirectory)
{
AppDomain.CurrentDomain.AssemblyResolve += (sender, args) =>
{
string assemblyPath = Path.Combine(baseDirectory, "System.Resources.Extensions.dll");
Assembly asm = Assembly.LoadFrom(assemblyPath);
return null;
};
}
}
Which I call from my app
string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;
var basePath = Path.GetDirectoryName(thisAssemblyPath);
AssemblyResolver.RegisterAssemblyResolver(basePath);
In my case, the DLLs are not loaded successfully, so I had to slightly modify the @benjamin_decreusefond solution.
2 more libraries were needed to run: System.Memory and System.Numerics.Vectors
public class AssemblyResolver
{
public static void RegisterAssemblyResolver(string baseDirectory)
{
AppDomain.CurrentDomain.AssemblyResolve += (sender, args) =>
{
if (args.Name.StartsWith("System.Resources.Extensions"))
return Assembly.LoadFrom(Path.Combine(baseDirectory, "System.Resources.Extensions.dll"));
if (args.Name.StartsWith("System.Memory"))
return Assembly.LoadFrom(Path.Combine(baseDirectory, "System.Memory.dll"));
if (args.Name.StartsWith("System.Numerics.Vectors"))
return Assembly.LoadFrom(Path.Combine(baseDirectory, "System.Numerics.Vectors.dll"));
return null;
};
}
}
Can't find what you're looking for? Ask the community or share your knowledge.