Compilation error when Postsharp is enabled

evdokimovn's Avatar

evdokimovn

03 Aug, 2013 02:39 PM

I have exactly the same problem as here (it is marked as closed and solved):
http://support.sharpcrafters.com/discussions/problems/1428-compilation-error-when-postsharp-is-enabled

Error 23 Unhandled exception (3.0.32.0, 32 bit, CLR 4.5, Release): PostSharp.Sdk.CodeModel.AssemblyLoadException: Cannot find assembly 'dotnetopenauth.aspnet, version=4.0.0.0, culture=neutral, publickeytoken=2780ccd10d57b246'. [Version mismatch]
============ PostSharp Assembly Loading Log ===================
LOG: Finding the assembly with binding identity 'dotnetopenauth.aspnet, version=4.0.0.0, culture=neutral, publickeytoken=2780ccd10d57b246'.
LOG: Found file 'C:\BitBucket\ithhdesktop\Management\ManagementSolution\packages\DotNetOpenAuth.AspNet.4.1.4.12333\lib\net45-full\DotNetOpenAuth.AspNet.dll' with identity 'dotnetopenauth.aspnet, version=4.1.0.0, culture=neutral, publickeytoken=2780ccd10d57b246, processorarchitecture=msil'.
LOG: Reference mismatch for ' \packages\DotNetOpenAuth.AspNet.4.1.4.12333\lib\net45-full\DotNetOpenAuth.AspNet.dll' [VersionMismatch].
LOG: Probing location 'C:\ProgramData\PostSharp\3.0.32\bin.Release\DotNetOpenAuth.AspNet.exe' because this directory was explicitly added to the search path [File Not Found].
LOG: Probing location 'C:\ProgramData\PostSharp\3.0.32\bin.Release\DotNetOpenAuth.AspNet.dll' because this directory was explicitly added to the search path [File Not Found].
LOG: Probing location 'C:\pathToApp\DotNetOpenAuth.AspNet.exe' because this directory was explicitly added to the search path [File Not Found].
LOG: Probing location 'C:\pathToApp\DotNetOpenAuth.AspNet.dll' because this directory was explicitly added to the search path [File Not Found].
LOG: Probing location 'C:\pathToApp\bin\DotNetOpenAuth.AspNet.exe' because this directory was explicitly added to the search path [File Not Found].
LOG: Found file 'C:\pathToApp\bin\DotNetOpenAuth.AspNet.dll' with identity 'dotnetopenauth.aspnet, version=4.1.0.0, culture=neutral, publickeytoken=2780ccd10d57b246, processorarchitecture=msil'.
LOG: Reference mismatch for 'C:\pathToApp\bin\DotNetOpenAuth.AspNet.dll' [VersionMismatch].
LOG: Probing location 'C:\pathToApp\obj\Release\DotNetOpenAuth.AspNet.exe' because this directory was explicitly added to the search path [File Not Found].
LOG: Probing location 'C:\pathToApp\obj\Release\DotNetOpenAuth.AspNet.dll' because this directory was explicitly added to the search path [File Not Found].
LOG: Probing location 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\DotNetOpenAuth.AspNet.exe' because this directory was explicitly added to the search path [File Not Found].
LOG: Probing location 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\DotNetOpenAuth.AspNet.dll' because this directory was explicitly added to the search path [File Not Found].
LOG: Probing location 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\DotNetOpenAuth.AspNet.exe' because this directory was explicitly added to the search path [File Not Found].
LOG: Probing location 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\DotNetOpenAuth.AspNet.dll' because this directory was explicitly added to the search path [File Not Found].
LOG: Looking in GAC for DotNetOpenAuth.AspNet, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246, processorArchitecture=x86.
LOG: Looking in GAC for DotNetOpenAuth.AspNet, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246, processorArchitecture=msil.
LOG: Looking in GAC for DotNetOpenAuth.AspNet, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246.
LOG: The assembly 'dotnetopenauth.aspnet, version=4.0.0.0, culture=neutral, publickeytoken=2780ccd10d57b246' was not found.
===============================================================
   at PostSharp.Sdk.CodeModel.Domain.GetAssembly(IAssemblyName assemblyName, BindingOptions bindingOptions)
   at PostSharp.Sdk.CodeModel.AssemblyRefDeclaration.^5YpB0scd(BindingOptions _0)
   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)

PostSharp support has replied with following:
"You probably have an assembly that looks for 4.0.0.0. It works well without PostSharp because you have assembly redirections in web.config, and now you have to tell PostSharp to use these assembly redirections."

Can you please be more specific?
I tried to add to web.config the following:
<assemblyBinding>
<assemblyIdentity name="dotnetopenauth.aspnet" publicKeyToken="2780ccd10d57b246" culture="neutral" />
<bindingRedirect oldVersion="4.0.0.0" newVersion="4.1.0.0"/>
</assemblyBinding>

but it doesn't help.

  1. 1 Posted by evdokimovn on 03 Aug, 2013 02:41 PM

    evdokimovn's Avatar

    and this also:
    <configuration>
    <assemblyBinding>
    <dependentAssembly>
    <assemblyIdentity name="dotnetopenauth.aspnet" publicKeyToken="2780ccd10d57b246" culture="neutral" />
    <bindingRedirect oldVersion="4.0.0.0" newVersion="4.1.0.0"/>
    </dependentAssembly>
    </assemblyBinding>

  2. 2 Posted by evdokimovn on 03 Aug, 2013 02:58 PM

    evdokimovn's Avatar

    also i have found redirections in web.config. so how can I make postSharp know about them?

  3. Support Staff 3 Posted by PostSharp Techn... on 05 Aug, 2013 12:54 PM

    PostSharp Technologies's Avatar

    Hello,

    The solution is to edit your csproj file and create a property named PostSharpHostConfigurationFile that points to your web.config.

    http://doc.postsharp.net/postsharp-3.0/##PostSharp-3.0.chm/html/c6e...

    -gael

  4. 4 Posted by Géza on 10 Aug, 2013 01:08 PM

    Géza's Avatar

    I've found somewhere else (
    http://support.sharpcrafters.com/discussions/problems/741-can-not-build-project )

    the soulution is to write in proj file:
      <PropertyGroup>
        <PostSharpHostConfigurationFile>app.config</PostSharpHostConfigurationFile>
      </PropertyGroup>

  5. PostSharp Technologies closed this discussion on 22 Nov, 2013 06:57 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac