- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I compiled the example Visual Studio app from Examples\Programming\PSoC6\SWD\C_Sharp and it works on my PC. When I copied the .exe and PP_COM_Wrapper.dll to another PC I get this error:
Unhandled Exception: System.TypeInitializationException: The type initializer for 'C_Sharp.Program' threw an exception. ---> System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {5042C3CA-4772-4C85-A47F-CE4BBCF577FD} failed due to the following error: 80040154.
at C_Sharp.Program..cctor()
--- End of inner exception stack trace ---
at C_Sharp.Program.Main(String[] args)
I copied the source code to the computer that failed and compiled the same project on that computer and have no problems running it. What do I need to do to make sure the .exe works on all computers?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yeah. So, after the dll is registered in the PC, you will find that in the COM tab in the references section.
Instead I would suggest you to use PSoCProgrammerCOM 35.0 Type Library found in the same COM tab. This would give you the same set of API's as the PPCOM_Wrapper.dll. Therefore you need not use Wrapper.dll file anymore.
The only advantage we get in PPCOM_Wrapper is that it is version independent. That is, even if the version of PSoC Programmer mismatches but has the same set of API's, the application will still run.
Let me know if it works.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The error occurs because the DLL is not being referenced correctly. In Visual Studio, under References, remove PP_COM_Wrapper.
Then right click on References and under Browse, locate the PP_COM_Wrapper.dll in your system and click OK.
Now build the solution. It should solve the error.
Please note that you will be able to run the .exe in all the computers. But to build the project, make changes to the code etc. in Visual Studio, the PP_COM_Wrapper references in the specific system should be provided.
Regards,
Dheeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I get the same problem when I copy exe and dll to a different PC. I don't want to compile a special version for every PC.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Added to DheerajK_81's reply, Please ensure that you have PSoC Programmer in the other PC where you put the .exe file.
If not, you have to download PSoC Programmer in the other PC. Here is the link: https://www.cypress.com/products/psoc-programming-solutions
If PSoC Programmer is present, check if the PSoC Programmer version of the other PC's and PC where you built the project are the same.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It works if I install the same version of PSoC Programmer on the target PC. However, if I don't have PP_COM_Wrapper.dll in the same directory as the .exe, it gives me the error:
Unhandled Exception: System.TypeInitializationException: The type initializer for 'C_Sharp.Program' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'PP_COM_Wrapper, Version=3.28.1.4162, Culture=neutral, PublicKeyToken=f1ff4c79bfa9df96' or one of its dependencies. The system cannot find the file specified.
File name: 'PP_COM_Wrapper, Version=3.28.1.4162, Culture=neutral, PublicKeyToken=f1ff4c79bfa9df96'
at C_Sharp.Program..cctor()
If the dll is already registered on the PC, how do I configure the project so it will use the dll already installed so I don't have to copy it along with the exe?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yeah. So, after the dll is registered in the PC, you will find that in the COM tab in the references section.
Instead I would suggest you to use PSoCProgrammerCOM 35.0 Type Library found in the same COM tab. This would give you the same set of API's as the PPCOM_Wrapper.dll. Therefore you need not use Wrapper.dll file anymore.
The only advantage we get in PPCOM_Wrapper is that it is version independent. That is, even if the version of PSoC Programmer mismatches but has the same set of API's, the application will still run.
Let me know if it works.
Thanks.