Deploying with pure dll
12 posts
• Page 1 of 2 • 1, 2
Deploying with pure dll
Hi,
I have a pure phalanger dll that contains classes called from a c# application.
I need to make all the application portable, in order to be able to run without installing Phalanger or anything else but I cannot deploy it...
I put on the same directory the c# exe, the pure dll and the needed phalanger files: PhpNetCore.dll, PhpNetClassLibrary.dll and all the needed extensions .mng and .dll.
There is also the .exe.config that contains the phpNet section needed to retrieve the extensions.
If I leave the .exe.config I receive an error that says the phpNet configuration section in not recognized, by leaving the .exe.config file it tells me that it cannot find the dll extensions...
The project works correctly on the development machine that has Phalanger installed.
The prerequisites on the target machine are installed (VC++ redist and .net framework), there is also a version of vs2010 express.
Many thanks
I have a pure phalanger dll that contains classes called from a c# application.
I need to make all the application portable, in order to be able to run without installing Phalanger or anything else but I cannot deploy it...
I put on the same directory the c# exe, the pure dll and the needed phalanger files: PhpNetCore.dll, PhpNetClassLibrary.dll and all the needed extensions .mng and .dll.
There is also the .exe.config that contains the phpNet section needed to retrieve the extensions.
If I leave the .exe.config I receive an error that says the phpNet configuration section in not recognized, by leaving the .exe.config file it tells me that it cannot find the dll extensions...
The project works correctly on the development machine that has Phalanger installed.
The prerequisites on the target machine are installed (VC++ redist and .net framework), there is also a version of vs2010 express.
Many thanks
- strfrank
- Posts: 20
- Joined: May 30th, 2012, 5:05 pm
Re: Deploying with pure dll
Hi,
Phalanger installer puts additional configuration into
The template of the machine configuration can be found at https://github.com/DEVSENSE/Phalanger/b ... ine.config.
You can include this configuration into your app.config (especially <paths> section). All the paths can be relative to the app.config file.
Phalanger installer puts additional configuration into
- Code: Select all
"%WinDir%\Microsoft.NET\Framework\v4.0.30319\Config\machine.config"
The template of the machine configuration can be found at https://github.com/DEVSENSE/Phalanger/b ... ine.config.
You can include this configuration into your app.config (especially <paths> section). All the paths can be relative to the app.config file.
Jakub Misek │ DEVSENSE s.r.o. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
Re: Deploying with pure dll
Hi,
I tried placing the missing configuration parameters inside my app.config, but when I try to change the Extensions directory I get an error, I tried this:
where php\Extensions is an existing subdirectory of the exe path where I put the extensions dlls.
I receive this error:
{" at PHP.ExtManager.DynamicModule..ctor(String _path, String _fileName, Boolean _earlyInit)\r\n at PHP.ExtManager.DynamicModule.LoadDynamicModule(ExtensionLibraryDescriptor descriptor)\r\n at PHP.ExtManager.RemoteDispatcher.LoadExtension(ExtensionLibraryDescriptor descriptor)"}
If I set ExtNatives to the full path of phalanger installation directory it works correctly.
UPDATE: if I copy the whole content of the Extensions folder to php\Extensions it works, at first I copied only the dlls I use in the project.
Thanks.
I tried placing the missing configuration parameters inside my app.config, but when I try to change the Extensions directory I get an error, I tried this:
- Code: Select all
<set name="ExtNatives" value="php\Extensions" />
where php\Extensions is an existing subdirectory of the exe path where I put the extensions dlls.
I receive this error:
{" at PHP.ExtManager.DynamicModule..ctor(String _path, String _fileName, Boolean _earlyInit)\r\n at PHP.ExtManager.DynamicModule.LoadDynamicModule(ExtensionLibraryDescriptor descriptor)\r\n at PHP.ExtManager.RemoteDispatcher.LoadExtension(ExtensionLibraryDescriptor descriptor)"}
If I set ExtNatives to the full path of phalanger installation directory it works correctly.
UPDATE: if I copy the whole content of the Extensions folder to php\Extensions it works, at first I copied only the dlls I use in the project.
Thanks.
- strfrank
- Posts: 20
- Joined: May 30th, 2012, 5:05 pm
Re: Deploying with pure dll
It is possible, extension you are using has another dependency. Surely you can remove php_*.dll you are not using.
Jakub Misek │ DEVSENSE s.r.o. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
Re: Deploying with pure dll
Many thanks, on my developer machine it was what you suggested, missing dll.
I then tried uninstalling phalanger and now it doesn't work anymore...
First error is: could not load php_bcmath.mng ...
php_bcmath is specified in <classLibrary> section in app.config.
If I place php_bcmath.mng.dll in the same path of the exe (just to try, I would like to place it in another directory) I get this error:
What can I do?
Is there a guide where I can look on how to deploy an application without installing phalanger?
thanks again
I then tried uninstalling phalanger and now it doesn't work anymore...
First error is: could not load php_bcmath.mng ...
php_bcmath is specified in <classLibrary> section in app.config.
If I place php_bcmath.mng.dll in the same path of the exe (just to try, I would like to place it in another directory) I get this error:
- Code: Select all
Value cannot be null.
Parameter name: descriptor
Stack trace:
at PHP.Core.LocalConfiguration.GetLibraryConfig(PhpLibraryDescriptor descriptor)
at PHP.Library.LibraryConfiguration.GetLocal(ScriptContext context)
at PHP.Library.PhpVariables.Serialize(DTypeDesc caller, Object variable)
What can I do?
Is there a guide where I can look on how to deploy an application without installing phalanger?
thanks again
- strfrank
- Posts: 20
- Joined: May 30th, 2012, 5:05 pm
Re: Deploying with pure dll
.mng.dll has to be placed together with phpnetcore.dll (it is its dependency). You can try to put it in another directory, by placing following into <classLibrary>
<add url='bin/php_bcmath.mng.dll' />
Do you have more from the stack trace?
<add url='bin/php_bcmath.mng.dll' />
Do you have more from the stack trace?
Jakub Misek │ DEVSENSE s.r.o. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
Re: Deploying with pure dll
Unfortunately I had no luck with <add url="">, the stack trace reports only those lines, the other ones are application specific.
I'm now trying with a simple app that uses ScriptContext.Call method and when I try to call for example bcadd it doesn't find bc_math.mng unless I put it in the exe dir, and if I try to call base64_decode it says 'call to undefined function base64_decode'.
This is app.config:
If I install phalanger it works correctly, looks like the paths section is being completely ignored (in the example I gave there are some commented parts).
Thanks.
I'm now trying with a simple app that uses ScriptContext.Call method and when I try to call for example bcadd it doesn't find bc_math.mng unless I put it in the exe dir, and if I try to call base64_decode it says 'call to undefined function base64_decode'.
This is app.config:
- Code: Select all
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="phpNet" type="PHP.Core.ConfigurationSectionHandler, PhpNetCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=0a8e8c4c76728c71" />
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
<phpNet>
<paths>
<!--<set name="DynamicWrappers" value="php\Dynamic" />-->
<!--<set name="Libraries" value="php\Bin" />-->
<set name="ExtWrappers" value="Wrappers" />
<!--<set name="ExtTypeDefs" value="php\TypeDefs" />-->
<!--<set name="ExtNatives" value="Extensions" />-->
</paths>
<classLibrary>
<add assembly="php_bcmath.mng, Version=3.0.0.0, Culture=neutral, PublicKeyToken=4ef6ed87c53048a3" section="bcmath" />
</classLibrary>
</phpNet>
</configuration>
If I install phalanger it works correctly, looks like the paths section is being completely ignored (in the example I gave there are some commented parts).
Thanks.
- strfrank
- Posts: 20
- Joined: May 30th, 2012, 5:05 pm
Re: Deploying with pure dll
You didn't merge your config with the base one (https://github.com/DEVSENSE/Phalanger/b ... ine.config). Especially the following is important, since it contains all the basic functionality:
- Code: Select all
<add assembly="PhpNetClassLibrary, Version=3.0.0.0, Culture=neutral, PublicKeyToken=4af37afe3cde05fb" section="bcl" />
<add assembly="PhpNetXmlDom, Version=3.0.0.0, Culture=neutral, PublicKeyToken=2771987119c16a03" section="dom"/>
Jakub Misek │ DEVSENSE s.r.o. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
Re: Deploying with pure dll
Thank you, I added the <add> elements you suggested and it works, I probably forgot them because I made a lot of tests...
Now the problem is that it works but only if I place all the needed files in the same directory, what should I do to use the directories specified in the <paths> section?
Thanks again
Now the problem is that it works but only if I place all the needed files in the same directory, what should I do to use the directories specified in the <paths> section?
Thanks again
- strfrank
- Posts: 20
- Joined: May 30th, 2012, 5:05 pm
Re: Deploying with pure dll
You need only ExtNatives and DynamicWrappers paths. '.mng.dll' and other .NET assemblies are loaded as standard .NET assemblies thru current .NET AppDomain. Try specifying their paths using the url='' attribute as suggested before.
Jakub Misek │ DEVSENSE s.r.o. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
12 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 25 guests