Question

I'm trying to import VS2010 Project into MonoDevelop. I updated it to version 4.3.0 so I get usual

/usr/lib/mono/4.0/Microsoft.Common.targets: Warning: Unable to find framework corresponding to the target framework moniker '.NETFramework,Version=v4.0,Profile=Client'. Framework assembly references will be resolved from the GAC, which might not be the intended behavior. (SlkRepair)

as a warning. However, I was faced with this error:

'SlkRepair/SlkRepair/SlkLib.cs(28,28): Error CS1110: 'SlkRepair.RegexEx.ContainsAny(this string, params char[])': Extension methods require 'System.Runtime.CompilerServices.ExtensionAttribute' type to be available. Are you missing an assembly reference? (CS1110) (SlkRepair)

The code for ContainsAny function:

public static class RegexEx
{
    public static bool ContainsAny(this string s, params char[] chars)
    {
        bool result = false;
        foreach (char c in chars)
        {
            result |= s.Contains(c);
            if (result)
                break;
        }
        return result;
    }
}

My project has such assembly references:

  • System
  • System.Core
  • System.Data
  • System.Data.DataSetExtensions
  • System.Xml
  • System.Xml.Linq

Trying to add Reference in Edit References doesn't help – I can't find it. Can anyone explain what Reference and how should I add? I'm a novice with MonoDevelop.

Was it helpful?

Solution

Two issues you need to fix first on Visual Studio side are,

  1. Mono does not support client profiles. Thus, make sure in Visual Studio you use full profiles instead of client profiles.

  2. The Mono runtime (not MonoDevelop) you use seems to be too old to support .NET 4.5, and thus ExtensionAttribute exception occurs. You will have to use Mono 3.2.8 at least. To check the Mono version you have, simply at terminal run mono --version. You can also downgrade your project to .NET 4 if you don't use any 4.5 features.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top