Run powershell commands in C#
You must use the import-module command to load the correct module for sharepoint. Use get-module to find available modules.
To do this programmatically, see my post on the subject:
-Oisin
I have this issue recently. In my case I was neither able to see the added solution nor able to add solution. So first I remove solution using below PowerShell Command:
(Get-SPSolution -Identity "YourSolution.wsp").Delete()
Then I was able to add my new code solution.