visual j# not working in .net 4

前端 未结 5 1964
面向向阳花
面向向阳花 2020-12-29 09:36

I tried to convert a project that relies on the vjs runtime to vs2010, but it errors out when trying to run.

It\'s giving the error that \"Could not load f

相关标签:
5条回答
  • 2020-12-29 10:01

    I have downloaded Microsoft Visual J# Version 2.0 Redistributable Package from http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=4712 and installed it.The issue is resolved.

    0 讨论(0)
  • 2020-12-29 10:04

    I got this to work by copying C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\vjsnativ.dll (for 64 bit Microsoft.NET\Framework64\v2.0.50727\vjsnativ.dll) to my application's debug/release directory.

    I suspect Microsoft will need to release another j# redistributable package to work with .net 4.0. Meanwhile, this work-around does a fine job.

    0 讨论(0)
  • 2020-12-29 10:06

    To add to the existing answers, I found that the solutions didn't work for me.

    First thing I did was to repair the Microsoft Visual J# 2.0 Redistributable Package -SE (x64) using Windows Control Panel (Just right click and click repair). This was in case I did any damage in my previous attempts to fix the problem.

    I had already implemented the solution provided by David Thielen.

    1 Extra step closed the deal for me (solved the problem): Copy "vjscor.dll", "vjslib.dll" and "vjsnativ.dll" from C:\Windows\Microsoft.NET\Framework64\v2.0.50727 To C:\Windows\Microsoft.NET\Framework\v2.0.50727

    So basically the Microsoft package placed the correct dlls into the 64-bit .NET framework and I had to manually move them into the 32-bit folder which is then copy-pasted into my solution folder by David Thielen's solution (above).

    0 讨论(0)
  • 2020-12-29 10:07

    The only way I could get it to work was to copy the C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\vjsnativ.dll to the C:\Windows\Microsoft.NET\Framework\v4.0.30319 folder. See http://community.microfocus.com/borland/managetrack/starteam/w/knowledge_base/17108.error-unable-to-load-dll-vjsnativ-the-specified-module-could-not-be-found-exception-from-hresult-0x8007007e.aspx

    0 讨论(0)
  • 2020-12-29 10:10

    Very simple solution - Calling J# code from .NET 4.0

    You take control and load it first supplying an explicit path. Then next time it's needed, it already knows the path (or it's already loaded in the AppDomain).

    You will need to use LoadLibrary function, so import the pinvoke reference:

    [DllImport("kernel32", SetLastError = true)]
    static extern IntPtr LoadLibrary(string lpFileName);
    

    The on load (either Main function in Console/WinForms or in Global.asax Application_Start):

    if (Environment.Version.Major >= 4)
    {
        string folder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), @"..\Microsoft.NET\Framework\v2.0.50727");
        folder = Path.GetFullPath(folder);
        LoadLibrary(Path.Combine(folder, "vjsnativ.dll"));
    }
    
    0 讨论(0)
提交回复
热议问题