NAnt build issues with Mono - mono

I am trying to build a Mono project using NAnt but I get the error listed below. I have tried altering the environment variable PKG_CONFIG_PATH to include the path leading to the file: mono.pc but that does not seem to work.
Failed to initialize the 'Mono 3.5 Profile' (mono-3.5) target framework.:
NAnt.Core.BuildException: Failed to initialize the 'Mono 3.5 Profile' (mono-3.5) target framework. ---> Unable to locate 'mono' module using pkg-config. Download the Mono development packages from http://www.mono-project.com/downloads/.:
NAnt.Core.BuildException: Unable to locate 'mono' module using pkg-config. Download the Mono development packages from http://www.mono-project.com/downloads/.
at NAnt.Core.Tasks.FailTask.ExecuteTask () [0x00000] in <filename unknown>:0
at NAnt.Core.Task.Execute () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at NAnt.Core.FrameworkInfo.Init () [0x00000] in <filename unknown>:0
at NAnt.Core.FrameworkInfo.Validate () [0x00000] in <filename unknown>:0
at NAnt.Core.ProjectSettingsLoader.ConfigureRuntimeFramework () [0x00000] in <filename unknown>:0

I've recently had the same problem trying to install the TAO Framework on Mac OSX 10.6.5 under Mono 2.8.1 with Nant 0.90 (FYI). Here's how I was led to solve this (guided by this page):
Locate the nant script itself ('/usr/bin/nant' on OSX, try 'which nant')
Open the 'nant' script in an editor (you might need the right permissions).
On a new line and before the 'exec ...' line, add something like:
export
PKG_CONFIG_PATH=/path/to/Mono/Framework/Versions/VERSION/lib/pkgconfig
my Mac OSX version looks like:
export PKG_CONFIG_PATH=/opt/local/lib/pkgconfig:/Library/Frameworks/Mono.framework/Versions/Current/lib/pkgconfig/
(nb. my version actually has 2 pkgconfig paths, separated by a colon ':', '/usr/lib/pkgconfig' is also searched automatically, JFYI).
Also, you should add the exact same 'export' line to one of your .bashrc or .profile files (or the corresponding /etc/bashrc or /etc/profile files to set this globally).
Hope this helps.
Cheers
Rich

For me adding '/Library/Frameworks/Mono.framework/Versions/Current/bin' to the PATH has solved the issue on Mac OS X 10.7.3 with Mono 2.10.9 and NAnt 0.91.

Related

ASP.NET vNext on Linux Ubuntu 14.04. Unable to load Kestrel

I've installed mono 3.8.0, installed kvm and ran the kp=vm upgrade and
My K runtime version is as follows
Active Version Runtime Location Alias
1.0.0-beta3 mono ~/.k/runtimes default
After running the kpm restore from the folder containing the project.json file
I get an error while running the k kestrel command.
I guess the following error has to do with the libuv installation, which I also have installed - version 1.4.2, or at least I think so. Has anyone come across this error ?
System.InvalidOperationException: Unable to load application or execute command 'Microsoft.AspNet.Hosting'. Available commands: web, kestrel. at Microsoft.Framework.ApplicationHost.Program.ThrowEntryPointNotfoundException (Microsoft.Framework.Runtime.DefaultHost host, System.String applicationName, System.Exception innerException) [0x00000] in <filename unknown>:0 at Microsoft.Framework.ApplicationHost.Program.ExecuteMain (Microsoft.Framework.Runtime.DefaultHost host, System.String applicationName, System.String[] args) [0x00000] in <filename unknown>:0 at Microsoft.Framework.ApplicationHost.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
Turns out that the problem was pretty simple. Although I had the kestrel command defined in the project.json file, I did not include the "Kestrel" dependency in the dependencies section.
Once I added that it worked.
For beta3, you need mono 3.12..

Nginx, mono-fastcgi, ServiceStack install

The ServiceStack website has build / install instructions for windows (Nuget). There are many posts referring to mono based ServiceStack, but never any instructions for how to build on Centos for example. I downloaded and built ServiceStack on windows and tried to bring the files over to Centos. So far this has not worked for my integration with mono-fastcgi. I get errors in the browser: "Parser Error Message: Cannot find type ServiceStack.Examples.Host.Web.Global" for example. This particular error is not really my question, unless it can get me further towards a ServiceStack installation that works. The real question is what is the best way to install ServiceStack and build it on Centos? (And getting Nuget to work on Centos is not a solution.. at least I can't get Nuget to build).
After working the steps listed below in discussion with Scott, the nuget.exe command line package manager gets the following errors:
[root#buffer1 nuget]# /usr/local/bin/mono nuget.exe install ServiceStack -Verbosity detailed -ConfigFile /root/nuget/NuGet.config
WARNING: Invalid certificate received from server. Error code: 0xffffffff800b010a
System.InvalidOperationException: Unable to find package 'ServiceStack'.
at NuGet.PackageRepositoryHelper.ResolvePackage (IPackageRepository sourceRepository, IPackageRepository localRepository, IPackageConstraintProvider constraintProvider, System.String packageId, NuGet.SemanticVersion version, Boolean allowPrereleaseVersions) [0x00000] in <filename unknown>:0
at NuGet.PackageRepositoryHelper.ResolvePackage (IPackageRepository sourceRepository, IPackageRepository localRepository, System.String packageId, NuGet.SemanticVersion version, Boolean allowPrereleaseVersions) [0x00000] in <filename unknown>:0
at NuGet.PackageManager.InstallPackage (System.String packageId, NuGet.SemanticVersion version, Boolean ignoreDependencies, Boolean allowPrereleaseVersions) [0x00000] in <filename unknown>:0
at NuGet.Commands.InstallCommand.InstallPackage (IFileSystem fileSystem, System.String packageId, NuGet.SemanticVersion version) [0x00000] in <filename unknown>:0
at NuGet.Commands.InstallCommand.ExecuteCommand () [0x00000] in <filename unknown>:0
at NuGet.Commands.Command.Execute () [0x00000] in <filename unknown>:0
at NuGet.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
[root#buffer1 nuget]#
Any ideas on using the command line nuget?
You mentioned that you have managed to get Mono to build on CentOS.
Don't build ServiceStack from source:
While it is possible, it's unnecessary. You can copy the existing ServiceStack dlls you may have from Windows; you don't need a special build, nor do you have to build them yourself on CentOS.
No Build instructions ... use NuGet:
There aren't specific instructions for building ServiceStack on CentOS, because there aren't instructions for building it from source at all. The recommended approach is to obtain the ServiceStack dlls from NuGet. But you'll only want to do that if you are using the CentOS machine as your development machine. In which case you can download the NuGet command line tool. Then simply run:
mono nuget.exe install ServiceStack
Then in you development IDE (I recommend monodevelop) reference the files that were downloaded by NuGet. See here for instructions on how to get Mono and MonoDevelop running on CentOS.
Invalid Certificate Warning:
This occurs when you haven't added the Mozilla Trusted Root Certificate Providers to the mono trusted providers store. You just need to do this action once, and mono will start trusting SSL certificates from the standard trusted sources:
mozroots --import --sync
See here for more information about Mono SSL Security.
Deploying:
It's just a case of copying your published project to CentOS and following these configuration instructions from the documentation. Except instead of using apt-get to install nginx you will need to use yum. But the configuration of nginx and fastcgi is the same.

Does fastcgi-mono-serverX work with mono 3.0 & nginx 1.2.4

I have been trying for some days to get mono 3.0 & nginx 1.2.4 and fastcgi-mono-serverX in the XSP 2.10 package going on Centos 6.3 ...the XSP4 server works but I can't get the fastcgi method working.
I built and tested mono 3.0 from source, it works fine.
I followed the config at http://www.mono-project.com/FastCGI_Nginx to no avail and many other settings from the nginx site.
...does the current XSP 2.10 module work with mono 3.0?
...should I downgrade mono to 2.11.4 to work with XSP 2.10?
...ultimately I would like to run ASP.Net 4.0 Web Forms
Update: Here's some output from the mono-server.log:
Server stack trace:
at Mono.WebServer.FastCgi.ApplicationHost.ProcessRequest (Mono.WebServer.FastCgi.Responder responder) [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) Mono.WebServer.FastCgi.ApplicationHost:ProcessRequest (Mono.WebServer.FastCgi.Responder)
at (wrapper xdomain-dispatch) Mono.WebServer.FastCgi.ApplicationHost:ProcessRequest (object,byte[]&,byte[]&)
Exception rethrown at [0]:
---> System.InvalidCastException: Cannot cast from source type to destination type.
at System.Configuration.ConfigurationManager.get_AppSettings () [0x00000] in <filename unknown>:0
at Mono.WebServer.FastCgi.WorkerRequest..cctor () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at (wrapper xdomain-invoke) Mono.WebServer.FastCgi.ApplicationHost:ProcessRequest (Mono.WebServer.FastCgi.Responder)
at (wrapper remoting-invoke-with-check) Mono.WebServer.FastCgi.ApplicationHost:ProcessRequest (Mono.WebServer.FastCgi.Responder)
at Mono.WebServer.FastCgi.Responder.Process () [0x00000] in <filename unknown>:0
[2012-11-05 12:35:14Z] Error Failed to process connection. Reason: The object was used after being disposed.
I was about to file a bug report with Xamarin... then I came across this submitted bug report from a year ago.
https://bugzilla.xamarin.com/show_bug.cgi?id=2876
tl;dr
You need to update the shell script (found with which mono-fastcgi-server4), and move mono-fastcgi-server4.exe from /usr/lib/mono/4.0 to /usr/lib/mono/4.5.
Longer Explanation
As mentioned, I'm using the mono-fastcgi-server4 package directly from the main canonical Ubuntu source which lists these file contents
/usr/bin/fastcgi-mono-server4
/usr/lib/mono/4.0/fastcgi-mono-server4.exe
/usr/lib/mono/gac/fastcgi-mono-server4/2.10.0.0__0738eb9f132ed756/fastcgi-mono-server4.exe
/usr/share/doc/mono-fastcgi-server4/AUTHORS
/usr/share/doc/mono-fastcgi-server4/NEWS.gz
/usr/share/doc/mono-fastcgi-server4/README
/usr/share/doc/mono-fastcgi-server4/README.Debian
/usr/share/doc/mono-fastcgi-server4/changelog.Debian.gz
/usr/share/doc/mono-fastcgi-server4/copyright
/usr/share/man/man1/fastcgi-mono-server4.1.gz
Based on the bug report solution, I was able to get this working. Essentially you edit the shell script used to launch fastcgi-mono-server4.exe by hand (which should be in /usr/bin), and move the .exe file by hand... or... you can use this little snippet of script that I incorporated into the deploy:setup of a Capistrano script. It uses sed to update the script.
fastcgi=$(which fastcgi-mono-server4) &&
sudo sed -i.bak -e 's/4\\.0/4.5/' $fastcgi &&
fastcgi_src='/usr/lib/mono/4.0/fastcgi-mono-server4.exe' &&
fastcgi_dest='/usr/lib/mono/4.5/fastcgi-mono-server4.exe' &&
if [ -f "$fastcgi_src" ]; then sudo mv $fastcgi_src $fastcgi_dest; fi;
This report also seems related
https://bugzilla.xamarin.com/show_bug.cgi?id=3582
If you use Mono 3.0, use a tag from xsp that is 3.x too. End of story.
Also, to avoid bugs like 3582, use Mono 3.0.3 or higher.

mono gtk hello world failing, 'Missing method'

I am trying out mono for the first time. Here are the steps I took to set it up.
Installed Kubuntu 12.04 LTS in VirtualBox
apt-get install mono-complete gtk-sharp2
Then I tried running the hello world applications in this tutorial.
http://www.mono-project.com/Mono_Basics
The command line application ran fine.
I compiled the GTK application with the following command as per the instructions:
gmcs hello.cs -pkg:gtk-sharp-2.0
When I run the application it fails with the following errors:
Missing method System.Type::op_Inequality(Type,Type) in assembly /usr/lib/mono/2.0/mscorlib.dll, referenced in assembly /usr/lib/mono/gac/gtk-sharp/2.12.0.0__35e10195dab3c99f/gtk-sharp.dll
Unhandled Exception: System.MissingMethodException: Method not found: 'System.Type.op_Inequality'.
at Gtk.Window..ctor (System.String title) [0x00000] in <filename unknown>:0
at Hello.Main () [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.MissingMethodException: Method not found: 'System.Type.op_Inequality'.
at Gtk.Window..ctor (System.String title) [0x00000] in <filename unknown>:0
at Hello.Main () [0x00000] in <filename unknown>:0
To me it looks like the mono libraries are incompatible with the gtk-sharp libraries.
Does anyone have any suggestions on how I can get this working?
All 12.04 Ubuntu editions have Mono defaulting to 4.0 profile (similar to .NET 4.0). You are compiling your hello.cs using gmcs compiler which is intended to target 2.0 profile (similar to .NET 2.0).
Use dmcs compiler instead of gmcs and the error will go away.

Not able to open MonoDevelop v 2.4.2

When I try to open MonoDevelop this error appears in the console log
com.apple.launchd.peruser.501[249] ([0x0-0x13013].com.ximian.monodevelop[308]) Exited with exit code: 255
How can I fix the problem?
EDIT: Snow Leopard 10.6.8, MonoDevelop 2.4.2 and Mono 2.10.5.
UPDATE: This is the error if I try to run MonoDevelop from shell
LSOpenURLsWithRole() failed with error -10810 for the file /Applications/MonoDevelop.app.
UPDATE 2: I've found the crash reporter for mono
FATAL ERROR [2011-09-03 15:06:25Z]: MonoDevelop failed to start. Some of the assemblies required to run MonoDevelop (for example gtk-sharp, gnome-sharp or gtkhtml-sharp) may not be properly installed in the GAC.
System.DllNotFoundException: /Library/Frameworks/Mono.framework/Versions/2.10.5/lib/libgtk-quartz-2.0.0.dylib
at (wrapper managed-to-native) Gtk.Application:gtk_init (int&,intptr&)
at Gtk.Application.do_init (System.String progname, System.String[]& args, Boolean check) [0x00000] in <filename unknown>:0
at Gtk.Application.Init (System.String progname, System.String[]& args) [0x00000] in <filename unknown>:0
at MonoDevelop.Ide.IdeStartup.Run (System.String[] args) [0x00000] in <filename unknown>:0
at MonoDevelop.Startup.MonoDevelopMain.Main (System.String[] args) [0x00000] in <filename unknown>:0
Any help?
For those interested in:
Uninstall Mono with this script uninstall script. You have to save the script in a file with extension .sh
Save the file in the desktop as uninstallMonoFr.sh (for example)
Open a terminal window: cd Desktop, sudo ./uninstallMonoFr.sh, insert your pwd
Download mono framework 2.10.4 (this version works for me)
Install again
I don't know if the problem is due to 2.10.5 version of mono framework. 2.10.4 works well.
UPDATE Seems that Mono 2.10.5 still presenting a package bug. MonoDevelop can't open with this version. Mono 2.10.4 works.
UPDATE 2 I've just installed 2.10.6 and it works. MonoDevelop now opens correctly.
This also helped me (permission issue):
http://answers.unity3d.com/questions/277759/cannot-start-built-in-monodevelop.html
I just added myself (user) with read&write permissions.