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

只愿长相守 提交于 2019-12-06 01:00:02

问题


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


回答1:


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?



来源:https://stackoverflow.com/questions/4450766/cant-add-net-4-0-assembly-reference-in-monodevelop-2-4-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!