Can't build a project with Postsharp 4.1.14

364 views Asked by At

I have a project which references a postsharp 4.1.14. When I build a project the error occurred. Postsharp is installed by nuget package. There is .net version 4.0 installed on computer, but Microsoft.Build.Utilities.ToolLocationHelper.GetPlatformSDKLocation method is from .net 4.5. Can I use different version of postsharp? Is there another way to fix my problem?

Error 1 The "PostSharp30GetInstalledFrameworks" task failed unexpectedly. System.MissingMethodException: Method not found: 'System.String Microsoft.Build.Utilities.ToolLocationHelper.GetPlatformSDKLocation(System.String, System.Version)'. at PostSharp.MSBuild.PostSharp30GetInstalledFrameworks.b__5(<>f__AnonymousType02 <>h__TransparentIdentifier0) at System.Linq.Enumerable.<>c__DisplayClass123.b__11(TSource x) at System.Linq.Enumerable.<>c__DisplayClass123.<CombineSelectors>b__11(TSource x) at System.Linq.Enumerable.<>c__DisplayClass123.b__11(TSource x) at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() at System.Xml.Linq.XContainer.AddContentSkipNotify(Object content) at PostSharp.MSBuild.PostSharp30GetInstalledFrameworks.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult) ConsoleApplication1

1

There are 1 answers

0
AlexD On BEST ANSWER

PostSharp 4.x requires at least Visual Studio 2012 and .NET Framework 4.5 installed on the development machine or build server (http://doc.postsharp.net/requirements). Your project can still target .NET 4.0, .NET 4.5 is needed only at build-time.

If you have only older versions of VS and .NET installed, then you can use PostSharp 3.x, which is still supported and works with VS 2010 and .NET 4.0.