Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't add .NET 4.0 Assembly Reference In MonoDevelop 2.4.1

I've installed MonoDevelop 2.4.1 With Mono 2.8.1. My trouble is that i can't add assembly reference to assembly compiled for .NET 4.0 (on same MonoDevelop IDE).

What am i do. References -> Edit References -> .NET Assembly -> Browse to file & select it

Than MD displays an error that an assembly that i'm trying to add isn't .NET assembly. I've set profile to .NET 4.0 everywhere.

Reflector disassembles my assembly fine so it's ok. My OS is Windows 7 What's wrong?

UPD: Posted a bug to Novell. Here it is https://bugzilla.novell.com/show_bug.cgi?id=659894

like image 389
ILya Avatar asked Dec 15 '10 14:12

ILya


1 Answers

When i do "C:\Program Files\Mono-2.8.1\bin\mono.exe" "C:\Program Files\MonoDevelop\bin\MonoDevelop.exe" the problem disapears.

It's understood that by running MonoDevelop.exe it runs on Microsoft .NET and the issue is that MonoDevelop (.NET 2.0 assembly) can't recognize an assembly (.NET 4.0) with use of 2.0 APIs.

Lets look at code (MonoDevelop.Ide.Projects.AssemblyReferencePanel):

private void SelectReferenceDialog(object sender, EventArgs e)
{
    string[] array = new string[this.chooser.Filenames.Length];
    this.chooser.Filenames.CopyTo(array, 0);
    foreach (string str in array)
    {
        bool flag = true;
        try
        {
            AssemblyName.GetAssemblyName(Path.GetFullPath(str));
        }
        catch
        {
            flag = false;
        }
        if (flag)
        {
            this.selectDialog.AddReference(new ProjectReference(ReferenceType.Assembly, str));
        }
        else
        {
            MessageService.ShowError(GettextCatalog.GetString("File '{0}' is not a valid .Net Assembly", str));
        }
    }
}

The line AssemblyName.GetAssemblyName(Path.GetFullPath(str)); is a source of all evil. I'm going to post a bug report to novell. Or it's not a bug?

like image 62
ILya Avatar answered Nov 03 '22 19:11

ILya