Skip to content
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

Problem loading plugin after updating the project to use VST.NET v2.1.1 #70

Open
Paegasus opened this issue Mar 21, 2024 · 3 comments
Open

Comments

@Paegasus
Copy link

My plugin was working fine using VST.NET 2.1.0 and targeting .NET 6.0.
After updating the VST.NET nuget package to 2.1.1 the plugin stops loading in any Host.

I managed to make it work again by targeting .Net 8.0 and
changing the version in the *.runtimeconfig.json file in the "deploy" folder accordingly.

Not sure where the problem is but v2.1.1 seems to be working with .Net 8.0 only.

@obiwanjacobi
Copy link
Owner

Yeah, I screwed up.
I have unlisted the v2.1.1. Please go back to 2.1.0 / .net6.

I am interested in the changes you made to *.runtimeconfig.json, though...

@Paegasus
Copy link
Author

Paegasus commented Apr 17, 2024

Yeah, I screwed up. I have unlisted the v2.1.1. Please go back to 2.1.0 / .net6.

I am interested in the changes you made to *.runtimeconfig.json, though...

I changed the target framework from "net6.0" to "net8.0" and the version from "6.0.0" to "8.0.0". After those changes the plugin loads fine, when compiled using .Net 8.0, of course.

Good luck, and thanks for the great work you've done with this library, hope you can fix it.

{
    "runtimeOptions": {
        "tfm": "net8.0",
        "framework": {
            "name": "Microsoft.WindowsDesktop.App",
            "version": "8.0.0"
        }
    }
}

@Delsin-Yu
Copy link

I am interested in the changes you made to *.runtimeconfig.json, though...

From the implementation in PublishCommand.cs it looks like you are copying the runtimeconfig.json you use to the deploy directory, which is as following:

{
    "runtimeOptions": {
        "tfm": "net6.0",
        "framework": {
            "name": "Microsoft.WindowsDesktop.App",
            "version": "6.0.0"
        }
    }
}

The dotnet host read this file and will try to boot the user code with .Net 6 runtime, which will fail when the target code is compiled with anything other than net6.0, for example, I got this when publishing with net9.0:

Chinese translates to System is unable to locate the target file

b0161b4a7c0e72bfe6020860cc5a0a90

I guess the fix would be to create that file by code based on the user code's runtime version, something similar to the following (replaces Line157):

File.WriteAllText(
    $$"""
    {
        "runtimeOptions": {
            "tfm": "{{userTargetFrameworkMoniker}}",
            "framework": {
                "name": "Microsoft.WindowsDesktop.App",
                "version": "{{userWindowsDesktopFrameworkVersion}}"
            }
        }
    }
    """, targetPath, overwrite: true
)

Of course, we need to figure out userTargetFrameworkMoniker and userWindowsDesktopFrameworkVersion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants