compile dll

Phalanger Tools for Visual Studio [?] is complete PHP/Phalanger integration into Visual Studio development environment.

compile dll

Postby danceoften » September 5th, 2016, 11:12 am

I am writing a c# managed dll for using it into an mvc web app.
I need to integrate some 3rd party php code in this dll:

1- can i compile a dll with mixed language code php + c#?
2- can i compile the 3rd party php code in a dll and reference in my own c# dll? (i just see web project and console app)
3- maybe i will just get or post to a php PAGE from my mvc app: can i add php page to a mvc app solution or should i have 2 separate projects?

what other options i have to interoperate from c# mvc app code ?

thank you in advance
danceoften
 
Posts: 14
Joined: May 29th, 2014, 2:36 pm

Re: compile dll

Postby danceoften » September 9th, 2016, 8:57 am

In order to do what i wrote above, I installed Phalanger.

After installing i get this error at visual studio startup
after VS starts , php projects appear as 'the application is not installed'

---------------------------
Microsoft Visual Studio
---------------------------
The 'PHP Tools for Visual Studio Package' package did not load correctly.

The problem may have been caused by a configuration change or by the installation of another extension. You can get more information by examining the file 'C:\Users\ME\AppData\Roaming\Microsoft\VisualStudio\14.0\ActivityLog.xml'.

Restarting Visual Studio could help resolve this issue.

Continue to show this error message?
---------------------------
Sì No
---------------------------
danceoften
 
Posts: 14
Joined: May 29th, 2014, 2:36 pm

Re: compile dll

Postby danceoften » September 9th, 2016, 11:32 am

update:
after the previous message we have the following:

---------------------------
Microsoft Visual Studio
---------------------------
The 'PhpTestPackage' package did not load correctly.

The problem may have been caused by a configuration change or by the installation of another extension. You can get more information by examining the file 'C:\Users\ME\AppData\Roaming\Microsoft\VisualStudio\14.0\ActivityLog.xml'.

Restarting Visual Studio could help resolve this issue.

Continue to show this error message?
---------------------------
Sì No
---------------------------
danceoften
 
Posts: 14
Joined: May 29th, 2014, 2:36 pm

Re: compile dll

Postby danceoften » September 9th, 2016, 3:49 pm

update:
i solved and restored phptools working, just reinstalling it.
I do not see Phalanger working in Vs

second update:
i found out that I needed to uninstall phptools before installing phalanger.
this way i solved the errors.
danceoften
 
Posts: 14
Joined: May 29th, 2014, 2:36 pm

Re: compile dll

Postby danceoften » September 12th, 2016, 7:35 am

danceoften wrote:I am writing a c# managed dll for using it into an mvc web app.
I need to integrate some 3rd party php code in this dll:

1- can i compile a dll with mixed language code php + c#?
2- can i compile the 3rd party php code in a dll and reference in my own c# dll? (i just see web project and console app)
3- maybe i will just get or post to a php PAGE from my mvc app: can i add php page to a mvc app solution or should i have 2 separate projects?

what other options i have to interoperate from c# mvc app code ?

thank you in advance


i found out that it's possible to use phalanger for this task and succeded installing it by first removing phptools.

i decided to move the original answer above in phalanger forum
danceoften
 
Posts: 14
Joined: May 29th, 2014, 2:36 pm

Re: compile dll

Postby Jakub Misek » September 12th, 2016, 8:31 am

Phalanger is a PHP language compiler, it produces DLL file from PHP files.

1. no, like you can't mix C# and VB.NET, you can however reference DLL from a C# project.
2. yes
3. you can, by using PHP.Core.RequestHandler into web.config, all the .php files are compiled on web server lazily and you can make requests to them. However you can do the same with legacy php.exe.

I would recommend to compile .php files into a DLL (either by creating a separate project in VS or in a prebuild action of your ASP.NET website `phpc.exe /target:dll /out:website.dll /recurse:.`, reference this DLL and make use of Php.Core.Context API where you can simulate PHP runtime.
Jakub Misek │ DEVSENSE s.r.o. │ Email: jakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2058
Joined: January 4th, 2012, 2:42 pm
Location: Prague

Re: compile dll

Postby danceoften » September 12th, 2016, 1:51 pm

Jakub Misek wrote:Phalanger is a PHP language compiler, it produces DLL file from PHP files.

1. no, like you can't mix C# and VB.NET, you can however reference DLL from a C# project.
2. yes
3. you can, by using PHP.Core.RequestHandler into web.config, all the .php files are compiled on web server lazily and you can make requests to them. However you can do the same with legacy php.exe.

I would recommend to compile .php files into a DLL (either by creating a separate project in VS or in a prebuild action of your ASP.NET website `phpc.exe /target:dll /out:website.dll /recurse:.`, reference this DLL and make use of Php.Core.Context API where you can simulate PHP runtime.


Thank you for your support, I decided i will go with solution 2:
I will compile third party php code in a managed dll and then reference it from my code (c# dll).

for doing this i found some instruction in an article :

http://tomasp.net/blog/aspnettexy.aspx/

where is suggested to just remove includes and to statically call defines in constructor.
so i modified the php code accordingly.

My question now is, wich template should i choose for having a managed dll ?
in the article it mention a pure mode but i cannot find this setting in the project properties when choosing the phalanger/class library.

Thank you again for the phalanger implementation of php under .net
danceoften
 
Posts: 14
Joined: May 29th, 2014, 2:36 pm

Re: compile dll

Postby Jakub Misek » October 2nd, 2016, 7:47 pm

Good.

Phalanger/Class Library is a Pure mode project.
Jakub Misek │ DEVSENSE s.r.o. │ Email: jakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2058
Joined: January 4th, 2012, 2:42 pm
Location: Prague

Re: compile dll

Postby Rock73 » June 14th, 2017, 9:55 am

After installing i get this error at visual studio startup
Rock73
 
Posts: 1
Joined: June 14th, 2017, 9:52 am


Return to Phalanger Tools

Who is online

Users browsing this forum: Bing [Bot] and 0 guests

cron

User Control Panel

Login

Who is online

In total there is 1 user online :: 1 registered, 0 hidden and 0 guests (based on users active over the past 5 minutes)
Most users ever online was 62 on January 7th, 2012, 10:54 pm

Users browsing this forum: Bing [Bot] and 0 guests
Phalanger