I posted this as an answer in a similar question but got no response so trying my luck here.
We have a .net 2.0 assembly with which PostSharp 1.5 is running fine. We have been given the go-ahead to upgrade to using VS2012.
The project has been auto-converted by VS2012 and I'm getting an error. I have made sure to target .net 3.5 within all the projects but am still getting
Error 27 Unhandled exception: PostSharp.CodeModel.BindingException: Cannot find the type 'System.Func`2' in assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
at PostSharp.CodeModel.AssemblyEnvelope.GetTypeDefinition(String typeName, BindingOptions bindingOptions)
at PostSharp.CodeModel.Domain.FindTypeDefinition(String assemblyQualifiedTypeName, BindingOptions bindingOptions)
at PostSharp.CodeModel.TypeRefDeclaration.GetTypeDefinition(BindingOptions bindingOptions)
at PostSharp.CodeModel.TypeSpecDeclaration.GetTypeDefinition(BindingOptions bindingOptions)
at PostSharp.Extensibility.Tasks.IndexGenericInstancesTask.Execute()
at PostSharp.Extensibility.Project.ExecutePhase(String phase)
at PostSharp.Extensibility.Project.Execute()
at PostSharp.Extensibility.PostSharpObject.ExecuteProjects()
at PostSharp.Extensibility.PostSharpObject.InvokeProject(ProjectInvocation projectInvocation)
at PostSharp.MSBuild.PostSharpRemoteTask.Execute(PostSharpTaskParameters parameters, TaskLoggingHelper log)
I checked the reference to System.Core and its definitely pointing at version 3.5.0.0 so the 4.0.0.0 reference above has also confused me somewhat.
I've read that PostSharp 1.5 works fine in VS 2010 targeting 3.5 and 4.0. But that some people have had to do some sort of magic hackery in project files etc.
Has anyone set up an environment as described above? (.net 3.5, VS2012 and PostSharp 1.5)
I'm already looking into alternatives and the community version of PostSharp 2.0 looks like the way to go. But in the mean time can this be done with current environment and what is the hackery needed?
Cheers
JAM
Update: One of the guys here thinks this is possible by hacking the MSBuild ToolSet. Can anyone shed any light?
Update: After adding the property group code section below, VS 2012 gives me this:
Error 26 The PostSharp build step failed (exit code 9009). See previous errors or the build log for details. Connectivity.Service.Client.Acl –
The error is due to a defect in PostSharp 1.5 that has been solved in PostSharp 2.0. The bug was not exposed when PostSharp 1.5 was being maintained because Microsoft did not use type forwarders yet.