[Mono-dev] Mono 2.10.2 TargetFrameworkAttribute

John Fallows john.fallows at kaazing.com
Sat Jul 9 13:06:57 EDT 2011


Thanks Jonathan,

Using dmcs instead of gmcs did the trick.

$ /opt/mono-2.10/bin/dmcs /target:library /out:bin/mono-test.dll
src/AssemblyAttributes.cs
$ ls bin/
mono-test.dll

Now works as initially expected.

tc,
-john.

On Sat, Jul 9, 2011 at 9:22 AM, Jonathan Pobst <monkey at jpobst.com> wrote:

> gmcs creates assemblies that target the 2.0 framework.
>
> TargetFrameworkAttribute is new in the 4.0 framework.
>
> Use dmcs to target the 4.0 framework.
>
> Jonathan
>
>
>
> On 7/9/2011 11:05 AM, John Fallows wrote:
>
>> Devs,
>>
>> Is System.Runtime.Versioning.**TargetFrameworkAttribute supported on Mono
>> 2.10.2 ?
>>
>> It appears to be available according to the documentation at
>> http://docs.go-mono.com/**System.Runtime.Versioning.**
>> TargetFrameworkAttribute<http://docs.go-mono.com/System.Runtime.Versioning.TargetFrameworkAttribute>.
>>
>> However, we are getting an unexpected compilation error for the simplest
>> example using TargetFrameworkAttribute, as shown below.
>>
>> We are using Mono 2.10.2 installed alongside the default Mono 2.6.7
>> package on Ubuntu 10.10.
>>
>> ~/mono-test$ uname -a
>> Linux jfallows-laptop 2.6.35-30-generic #54-Ubuntu SMP Tue Jun 7
>> 18:41:54 UTC 2011 x86_64 GNU/Linux
>>
>> ~/mono-test$ which gmcs
>> /usr/bin/gmcs
>>
>> ~/mono-test$ gmcs --version
>> Mono C# compiler version 2.6.7.0
>>
>> ~/mono-test$ /opt/mono-2.10/bin/gmcs --version
>> Mono C# compiler version 2.10.2.0
>>
>> ~/mono-test$ cat src/AssemblyAttributes.cs
>> using System.Reflection;
>> using System.Runtime.**CompilerServices;
>> [assembly:
>> global::System.Runtime.**Versioning.**TargetFrameworkAttribute(".**
>> NETPortable,Version=v4.0,**Profile=Profile2",**
>> FrameworkDisplayName="Portable
>> Library")]
>>
>> ~/mono-test$ /opt/mono-2.10/bin/gmcs /target:library
>> /out:bin/mono-test.dll src/AssemblyAttributes.cs
>> src/AssemblyAttributes.cs(3,**46): error CS0234: The type or namespace
>> name `TargetFrameworkAttribute' does not exist in the namespace
>> `System.Runtime.Versioning'. Are you missing an assembly reference?
>> src/AssemblyAttributes.cs(3,**46): error CS0234: The type or namespace
>> name `**TargetFrameworkAttributeAttrib**ute' does not exist in the
>> namespace
>> `System.Runtime.Versioning'. Are you missing an assembly reference?
>>
>> If we comment out line 3 in src/AssemblyAttributes.cs as follows:
>> using System.Reflection;
>> using System.Runtime.**CompilerServices;
>> //[assembly:
>> global::System.Runtime.**Versioning.**TargetFrameworkAttribute(".**
>> NETPortable,Version=v4.0,**Profile=Profile2",**
>> FrameworkDisplayName="Portable
>> Library")]
>>
>> then compilation succeeds as desired.
>> ~/mono-test$ /opt/mono-2.10/bin/gmcs /target:library
>> /out:bin/mono-test.dll src/AssemblyAttributes.cs
>> ~/mono-test$ ls bin/
>> mono-test.dll
>>
>> How can we make compilation successful when the TargetFrameworkAttribute
>> line is not commented?
>>
>> Kind Regards,
>> John Fallows
>> --
>>  >|< Kaazing Corporation >|<
>> John Fallows | CTO | +1.650.960.8148
>> 444 Castro St, Suite 1100 | Mountain View, CA 94041, USA
>>
>>
>>
>> ______________________________**_________________
>> Mono-devel-list mailing list
>> Mono-devel-list at lists.ximian.**com <Mono-devel-list at lists.ximian.com>
>> http://lists.ximian.com/**mailman/listinfo/mono-devel-**list<http://lists.ximian.com/mailman/listinfo/mono-devel-list>
>>
>
>


-- 
>|< Kaazing Corporation >|<
John Fallows | CTO | +1.650.960.8148
444 Castro St, Suite 1100 | Mountain View, CA 94041, USA
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20110709/404279d3/attachment-0001.html 


More information about the Mono-devel-list mailing list