Well, some weird news, all is now working. I did nothing except:

I first tried updating PostSharp to version 2.1.7.6. This made no changes.
Then, I created the sample in VS 2012:
http://www.sharpcrafters.com/postsharp/documentation#getting-started. No
work...
In utter desperation I created the same project in VS 2012. It worked. Hmm.
So I tried the VS 2012 project again. Still no go.
Then, the brainwave. The VS 2010 project works, so lets open that in VS
2012. That worked. The only difference was the project files and the VS
version.
I assumed that as the same project file (the one from VS 2010) worked in
both VS versions, then it must be the project file. Wrong! Both the code
and the project file were exactly the same. The only difference was the
project GUID - one line.

Now here comes the crazy part (before I broke down in tears):
I opened the original project (the one with the errors). It now builds fine
:)

Don't ask me what happened. I haven't touched that project since yesterday.
Maybe it was the upgrade slowly kicking in or maybe it was the first build
with VS 2010. Or maybe it was the incessant building and re-building. (Or
the hand waving).

Note: you do need the PostSharp.Custom.targets file.

So the sum of the story is: It works. Who knows why.

Hope this helps :)

Matthew


On Fri, Aug 3, 2012 at 8:46 AM, Matthew Leibowitz
<mattleibowm...@gmail.com>wrote:

> Hi,
>
> That "when I get home" turned into a "tomorrow", but here is some more
> information:
>
> With just a plain old PostSharp 2.1 install and a simple project I get
> this:
>
> Unhandled exception (2.1.3.3, 32 bit, CLR 2.0, Release):
>> PostSharp.Sdk.CodeModel.BindingException: Cannot find the type
>> 'System.Func`2' in assembly 'mscorlib, Version=2.0.0.0, Culture=neutral,
>> PublicKeyToken=b77a5c561934e089'.
>>    at PostSharp.Sdk.CodeModel.AssemblyEnvelope.GetTypeDefinition(String
>> typeName, BindingOptions bindingOptions)
>>    at
>> PostSharp.Sdk.CodeModel.TypeRefDeclaration.GetTypeDefinition(BindingOptions
>> bindingOptions)
>>    at
>> PostSharp.Sdk.CodeModel.TypeSpecDeclaration.GetTypeDefinition(BindingOptions
>> bindingOptions)
>>    at
>> PostSharp.Sdk.Extensibility.Tasks.IndexGenericInstancesTask.Execute()
>>    at PostSharp.Sdk.Extensibility.Project.ExecutePhase(String phase)
>>    at PostSharp.Sdk.Extensibility.Project.Execute()
>>    at PostSharp.Hosting.PostSharpObject.ExecuteProjects()
>>    at PostSharp.Hosting.PostSharpObject.InvokeProject(ProjectInvocation
>> projectInvocation)
>
>
> So following the tips of experts, I added a PostSharp.Custom.targets file
> to my solution folder:
>
> <?xml version="1.0" encoding="utf-8" ?>
>> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003";>
>>     <PropertyGroup>
>>
>> <PostSharpAssemblyBindingPolicySet>Silverlight20</PostSharpAssemblyBindingPolicySet>
>>     </PropertyGroup>
>> </Project>
>
>
> This results in a new error:
>
> Unhandled exception (2.1.3.3, 32 bit, CLR 2.0, Release):
>> PostSharp.Sdk.CodeModel.AssemblyLoadException: Cannot load assembly
>> mscorlib_3. [Version mismatch]
>> ============ PostSharp Assembly Loading Log ===================
>> LOG: Finding the assembly with binding identity 'mscorlib,
>> version=5.0.5.0, culture=neutral, publickeytoken=7cec85d7bea7798e,
>> processorarchitecture=msil'.
>> LOG: Probing location 'C:\Program Files (x86)\Reference
>> Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll' because this
>> file was explicitly added to the search path.
>> LOG: File 'C:\Program Files (x86)\Reference
>> Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll' has identity
>> 'mscorlib, version=2.0.5.0, culture=neutral,
>> publickeytoken=7cec85d7bea7798e, processorarchitecture=msil'.
>> LOG: File 'C:\Program Files (x86)\Reference
>> Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll' does not
>> match the reference.
>> LOG: Probing location 'C:\Program Files (x86)\PostSharp
>> 2.1\Release\mscorlib.exe' because this directory is in the search path.
>> LOG: The file 'C:\Program Files (x86)\PostSharp 2.1\Release\mscorlib.exe'
>> could not be found.
>> LOG: Probing location 'C:\Program Files (x86)\PostSharp
>> 2.1\Release\mscorlib.dll' because this directory is in the search path.
>> LOG: The file 'C:\Program Files (x86)\PostSharp 2.1\Release\mscorlib.dll'
>> could not be found.
>> LOG: Probing location
>> 'C:\BrandDirector\Mobile\Brandirector.Mobile\BrandDirector.Core.Aspects\mscorlib.exe'
>> because this directory is in the search path.
>> LOG: The file
>> 'C:\BrandDirector\Mobile\Brandirector.Mobile\BrandDirector.Core.Aspects\mscorlib.exe'
>> could not be found.
>> LOG: Probing location
>> 'C:\BrandDirector\Mobile\Brandirector.Mobile\BrandDirector.Core.Aspects\mscorlib.dll'
>> because this directory is in the search path.
>> LOG: The file
>> 'C:\BrandDirector\Mobile\Brandirector.Mobile\BrandDirector.Core.Aspects\mscorlib.dll'
>> could not be found.
>> LOG: Probing location 'C:\Program Files (x86)\PostSharp
>> 2.1\PlugIns\mscorlib.exe' because this directory is in the search path.
>> LOG: The file 'C:\Program Files (x86)\PostSharp 2.1\PlugIns\mscorlib.exe'
>> could not be found.
>> LOG: Probing location 'C:\Program Files (x86)\PostSharp
>> 2.1\PlugIns\mscorlib.dll' because this directory is in the search path.
>> LOG: The file 'C:\Program Files (x86)\PostSharp 2.1\PlugIns\mscorlib.dll'
>> could not be found.
>> LOG: Probing location
>> 'C:\BrandDirector\Mobile\Brandirector.Mobile\BrandDirector.Core.Aspects\bin\Debug\mscorlib.exe'
>> because this directory is in the search path.
>> LOG: The file
>> 'C:\BrandDirector\Mobile\Brandirector.Mobile\BrandDirector.Core.Aspects\bin\Debug\mscorlib.exe'
>> could not be found.
>> LOG: Probing location
>> 'C:\BrandDirector\Mobile\Brandirector.Mobile\BrandDirector.Core.Aspects\bin\Debug\mscorlib.dll'
>> because this directory is in the search path.
>> LOG: The file
>> 'C:\BrandDirector\Mobile\Brandirector.Mobile\BrandDirector.Core.Aspects\bin\Debug\mscorlib.dll'
>> could not be found.
>> LOG: Probing location
>> 'C:\BrandDirector\Mobile\Brandirector.Mobile\BrandDirector.Core.Aspects\obj\Debug\mscorlib.exe'
>> because this directory is in the search path.
>> LOG: The file
>> 'C:\BrandDirector\Mobile\Brandirector.Mobile\BrandDirector.Core.Aspects\obj\Debug\mscorlib.exe'
>> could not be found.
>> LOG: Probing location
>> 'C:\BrandDirector\Mobile\Brandirector.Mobile\BrandDirector.Core.Aspects\obj\Debug\mscorlib.dll'
>> because this directory is in the search path.
>> LOG: The file
>> 'C:\BrandDirector\Mobile\Brandirector.Mobile\BrandDirector.Core.Aspects\obj\Debug\mscorlib.dll'
>> could not be found.
>> LOG: Probing location 'C:\Program Files (x86)\Reference
>> Assemblies\Microsoft\Framework\MonoAndroid\v2.2\mscorlib.exe' because this
>> directory is in the search path.
>> LOG: The file 'C:\Program Files (x86)\Reference
>> Assemblies\Microsoft\Framework\MonoAndroid\v2.2\mscorlib.exe' could not be
>> found.
>> LOG: Probing location 'C:\Program Files (x86)\Reference
>> Assemblies\Microsoft\Framework\MonoAndroid\v2.2\mscorlib.dll' because this
>> directory is in the search path.
>> LOG: The file 'C:\Program Files (x86)\Reference
>> Assemblies\Microsoft\Framework\MonoAndroid\v2.2\mscorlib.dll' could not be
>> found.
>> LOG: Probing location 'C:\Program Files (x86)\Reference
>> Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.exe' because this
>> directory is in the search path.
>> LOG: The file 'C:\Program Files (x86)\Reference
>> Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.exe' could not be
>> found.
>> LOG: Probing location 'C:\Program Files (x86)\Reference
>> Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll' because this
>> directory is in the search path.
>> LOG: File 'C:\Program Files (x86)\Reference
>> Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll' has identity
>> 'mscorlib, version=2.0.5.0, culture=neutral,
>> publickeytoken=7cec85d7bea7798e, processorarchitecture=msil'.
>> LOG: File 'C:\Program Files (x86)\Reference
>> Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll' does not
>> match the reference.
>> LOG: The assembly 'mscorlib_3' was not found.
>> ===============================================================
>>    at PostSharp.Sdk.CodeModel.Domain.GetAssembly(IAssemblyName
>> assemblyName, BindingOptions bindingOptions)
>>    at PostSharp.Sdk.CodeModel.AssemblyRefDeclaration.GetAssemblyEnvelope()
>>    at
>> PostSharp.Sdk.Extensibility.Tasks.MulticastAttributeTask.^SgrhoGlQ(AssemblyRefDeclaration
>> _0)
>>    at
>> PostSharp.Sdk.Extensibility.Tasks.MulticastAttributeTask.^+GwnKh4ZYHu3()
>>    at PostSharp.Sdk.Extensibility.Tasks.MulticastAttributeTask.Execute()
>>    at PostSharp.Sdk.Extensibility.Project.ExecutePhase(String phase)
>>    at PostSharp.Sdk.Extensibility.Project.Execute()
>>    at PostSharp.Hosting.PostSharpObject.ExecuteProjects()
>>    at PostSharp.Hosting.PostSharpObject.InvokeProject(ProjectInvocation
>> projectInvocation)
>
>
> Not quite sure what this means...
>
> I will try some other things, but if this rings any bells with you guys
> out there, let me know.
>
> Matthew
>
>
> On Thu, Aug 2, 2012 at 6:30 PM, Matthew Leibowitz <
> mattleibowm...@gmail.com> wrote:
>
>> Hi all,
>>
>> Has anyone tried using postsharp 2.1 with mono for android?
>>
>> One guy managed to get it to work, but he was using version 2. Version
>> 2.1 seems to use the mscorlib 5? Maybe its because of silverlight 5 being
>> installed?
>>
>> I'll see if I can give some more info when I get home, but I just wanted
>> to see if anyone tried something?
>>
>> Matthew
>>
>> Sent from my Android.
>>
>
>
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to