FD_SamplePlugin icon indicating copy to clipboard operation
FD_SamplePlugin copied to clipboard

Error when loading plugin

Open markknol opened this issue 10 years ago • 20 comments

I try to create own plugin. I renamed everything that's called sampleplugin, added own guid. and compiled it (that works :smile: ) But when loading I get this error:

Could not load file or assembly 'file:///C:\xxxxx\AppData\Local\HaxeDevelop\Plugins\MyPlugin.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

I see you solved it already here https://github.com/skial/FD_SamplePlugin/commit/2308614a8ff5e09a898dfda08de7c0afc1cc8bb2 , but I cannot figure out what needs to be done to fix it.

Any hint?

markknol avatar Jan 26 '16 10:01 markknol

I think that error was related to using .net framework 4 or the dll file containing duplicate references to other dll files. FlashDevelop plugins should build with .net 2+. I use 3.5 in my build.hxml, pointing -D csc to C:\Windows\Microsoft.NET\Framework\v3.5\csc.exe .

Ignore the FD_SamplePlugin.hxml, it ended up just being used for autocompletion.

I found ILSpy really useful to peek into the compiled dll file to make sure what version of .net built the file and other info.

skial avatar Jan 26 '16 10:01 skial

When compiling using build.xml I seem to miss the resgen.exe file. I maybe need to install something.

markknol avatar Jan 26 '16 10:01 markknol

I unfortunately didn't download anything secific for this project, I must have downloaded it awhile ago :/. I think resgen is part of the windows sdk.

skial avatar Jan 26 '16 10:01 skial

For some reason this installer don't let me install the sdk. Kinda stuck here.

image

markknol avatar Jan 26 '16 10:01 markknol

I've been looking around to see how I might have "installed" all the dependencies. If you have visual studio 2015 community edition installed, there is an option when installing or modifying (through add and remove programs) to install the Windows 10 sdk.

This might work on previous editions of visual studio as well??

skial avatar Jan 26 '16 11:01 skial

(Oh, hey, I don't even have visual studio installed :open_mouth: )

markknol avatar Jan 26 '16 11:01 markknol

:grin:

When I get some spare time, I'll see if my laptop is able to build this and try to record everything needed to set it up.

skial avatar Jan 26 '16 11:01 skial

I now have vs community edition installed, but the build.hxml now complains about missing parameters

image

update: I changed the lines to:

//line 88
var resgen_proc = new Process('$_resgen', ['$output/src/Resources/en_US.resX']);

//line 116:
var csc_proc = new Process( '$_csc' , csc_args );

But now i have this error; image

markknol avatar Jan 26 '16 12:01 markknol

Hey @markknol,

I've pushed an update that works on a fresh install of visual studio and haxe 3.2.1. I forgot that I was a git build of haxe while figuring this all out. Sorry!. There has been an api change to Process.hx at some point.

I've, hopefully have also fixed the cs2021 error.

skial avatar Jan 26 '16 14:01 skial

Scratch the Process.hx change rubbish, I've just tried it on a git build of Haxe and it works with the recent commit I've made. :frowning:

skial avatar Jan 26 '16 14:01 skial

hey it works! It opens the plugin :smile:

markknol avatar Jan 26 '16 15:01 markknol

Yay!

skial avatar Jan 26 '16 15:01 skial

Hey @markknol,

I've being looking through @waneck hxcs and figured out how to start replacing build/Tool.hx with it, would you be able to try out the latest changes?

The only file thats really changed is build.hxml, so just make sure all the paths are correct for you :wink:. You will also need to install my fork of hxcs.

skial avatar Jan 27 '16 14:01 skial

Hey I installed the git hxcs and pulled fresh copy of the repository. I compiled and tested; it works. Nice! :smile:

The only annoying thing is that it compiles to Main.dll, while you want it to be named something like SamplePlugin.dll, not sure if that is doable.

markknol avatar Jan 27 '16 14:01 markknol

btw I assume this git dependency will not be needed in future right?

markknol avatar Jan 27 '16 15:01 markknol

Hopefully it won't be needed. If for whatever reason it cant be merged into hxcs, then a macro tool to do the same job can be written.

skial avatar Jan 27 '16 15:01 skial

Hey I installed the git hxcs and pulled fresh copy of the repository. I compiled and tested; it works. Nice! :smile:

The only annoying thing is that it compiles to Main.dll, while you want it to be named something like SamplePlugin.dll, not sure if that is doable.

Brilliant, thanks for trying it out. Yep, I'll look into the name issue.

skial avatar Jan 27 '16 15:01 skial

@markknol Turns out that the dll being generated as Main.dll is simply based on the entry files name.

skial avatar Jan 28 '16 09:01 skial

Nice, then you need $(ProjectName).hx.template instead of Main.hx (and point to that as main class) :wink:

markknol avatar Jan 28 '16 09:01 markknol

btw I assume this git dependency will not be needed in future right?

Just an update, there is a pull request to hxcs that will hopefully remove the git dependency, once its reviewed.

skial avatar Feb 10 '16 09:02 skial