About My Blog



Whenever I get stuck doing something - the time comes to venture in the world of internet to find solution. In most cases I do find the solution, solve my problem and go on with my life. Then one day I am faced with the same problem. But now - I can't remember how the hell I solved it the first time. So the cycle begins again. Then I thought, what if I can remember all the those things? So here it is, my Auxiliary Memory. I decided to save all the problems and their solution in this blog so that I can get back to them when I need them. And the plus point is - so can everybody else.

Monday, November 3, 2014

Cannot launch/debug ASP.NET/ASP.NET MVC on MonoDevelop on Ubuntu 14.x

If you have installed Monodevelop 5.1 from ermshiperete's PPA then you might be facing this problem. When you try to run the project MonoDevelop will say it can't find xsp4.
The problem is that the PPA provides local mono but does not provide mono-xsp4 because of compatibility issues. So first we need to install mono-xsp4
sudo apt-get install mono-xsp4
Then we need to tell MonoDevelop to use User's mono runtime instead of the local one to run the project. For that we need to goto Edit>Preferences.. from MonoDevelop menu and select Mono*** (/usr) and set it as default.
Now if you try to run the project, it will run but you will get an error page saying System.MissingMethodException: Method not found: 'System.Configuration.IConfigurationSectionHandler.Create'. The problem is that mono-xsp4 cannot locate some dll files when run from MonoDevelop probably because the launcher script /opt/monodevelop/bin/monodevelop-launcher.sh set some environment variables before starting MonoDevelop.
To get around it we need to run MonoDevelop itself with the users mono runtime. You can see in the above picture that even though we have set users runtime as default, monodevelop was using the local mono to run itself. So, lets run monodevelop with users mono runtime. First copy the monodevelop script that monodevelop-launcher.sh calls to run monodevelop to someplace with easier access.
cp /opt/monodevelop/bin/monodevelop ~/Desktop/monodevelop
Now modify the value of EXE_PATH to directly point to MonoDevelop.exe
EXE_PATH=/opt/monodevelop/lib/monodevelop/bin/MonoDevelop.exe
Save the file.
Now run monodevelop script from desktop and monodevelop will start using users mono.
./monodevelop
If you try to run web application now xsp4 will successfully run them and you can also debug them. I have tested it with ASP.NET MVC 2 Project. You can also verify that monodevelop is using users mono runtime by going to the above mentioned screen.
P.S. If any registry access error is shown then we need to create the following directories and set their permissions.
sudo mkdir /etc/mono/registry
sudo mkdir /etc/mono/registry/LocalMachine
sudo chmod g+rwx /etc/mono/registry
sudo chmod g+rwx /etc/mono/registry/LocalMachine

No comments:

Post a Comment