I was working with PHP version 5.4.19 and was willing to parse few codes through a .dll file which I would create using Visual C# 2010 Express edition.
So, I started and created a Project using Visual C# 2010 as Class Library. This initially loaded my project and dropped me to Class1.cs file. First I changed the file name to MyClass.cs which contains the following line:
public class MyClass
protected String myScope;
public void setScope(String scope)
this.myScope = scope;
public String getScope()
The AssemblyInfo.cs file contains the following line implemented:
From the Project Properties section, I changed the Target Framework from 4.0 to 3.5 Client Profile, and in the signing section I named it as NiladriSen.InfoValley.Sample and then using the gacutil tool I registered it in GAC with the following command:
Note: As my namespace for class MyClass reflects as [text]namespace NiladriSen.InfoValley.Sample;[/text] should I need to change the Assembly name as [text]NiladriSen.InfoValley.Sample[/text]?gacutil /i NiladriSen.dll
Finally, when I called this using DOTNET class in PHP as $sample = new DOTNET("NiladriSen, Version=2.3.X.XXXX, Culture=en, PublicKeyToken=XXXXXXXXXXXXXXXX", "NiladriSen.InfoValley.Sample.MyClass"); it threw the following error:
PHP Fatal error: Uncaught exception 'com_exception' with message 'Failed to instantiate .Net object [CreateInstance] [0x80070002] The system cannot find the file specified.' in C:\Users\*******\Desktop\Sample.php:2
If I change the PHP code as $sample = new DOTNET("NiladriSen.InfoValley.Sample, Version=2.3.X.XXXX, Culture=en, PublicKeyToken=XXXXXXXXXXXXXXXX", "NiladriSen.InfoValley.Sample.MyClass"); it threw the following error:
PHP Fatal error: Uncaught exception 'com_exception' with message 'Failed to instantiate .Net object [CreateInstance] [0x80131522] ' in C:\Users\*******\Desktop\Sample.php:2
Question: Is there any way to fix this up? Elaborately, can I use that particular .dll file created using Visual C# 2010 in PHP 5.4.19 at all?
I am using Vista Home Basic (SP 2), Visual C# 2010 Express edition, PHP 5.4.19, Apache 2.2 & 2.4 versions
I signed this file with no password set at all in Project Properties section.