Revit Architecture Forum
Welcome to Autodesk’s Revit Architecture Forums. Share your knowledge, ask questions, and explore popular Revit Architecture topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

System.Resources.Extensions not found

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
benjamin_decreusefond
437 Views, 5 Replies

System.Resources.Extensions not found

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 !

5 REPLIES 5
Message 2 of 6

Have you contacted the author of the plug-in?  

Message 3 of 6

He is kind of missing lol 😂

I’m alone there
Message 4 of 6

I have the exact same issue with Inventor 2022. Also I have tried the approaches you mentioned, but no luck.

 

Thanks,

-Thilak Rao

Message 5 of 6

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);
Message 6 of 6

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.

Post to forums  

Autodesk Design & Make Report