none
.Net Framework Assembly Version Issue RRS feed

  • Question

  • A WCF service built with .Net Framework v4.5 references System.Data assembly and a custom made assembly built in another solution using .Net Framework v3.5. The project of the latter assembly also references the System.Data assembly.

     

    My WCF service builds successfully and starts correctly, but when an attempt is made to obtain a DataTable object over the referenced custom made assembly it throws the following exception:

     

    System.IO.FileNotFoundException was caught

      HResult=-2147024894

      Message=Could not load file or assembly 'System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.

      Source=mscorlib

      FileName=System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

      FusionLog=WRN: Assembly binding logging is turned OFF.

    To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.

    Note: There is some performance penalty associated with assembly bind failure logging.

    To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

     

      StackTrace:

        Server stack trace:

           at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)

           at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)

           at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)

           at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)

           at System.Reflection.Assembly.Load(String assemblyString)

           at System.UnitySerializationHolder.GetRealObject(StreamingContext context)

           at System.Runtime.Serialization.ObjectManager.ResolveObjectReference(ObjectHolder holder)

           at System.Runtime.Serialization.ObjectManager.DoFixups()

           at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)

           at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)

           at System.Runtime.Remoting.Channels.CoreChannel.DeserializeBinaryRequestMessage(String objectUri, Stream inputStream, Boolean bStrictBinding, TypeFilterLevel securityLevel)

           at System.Runtime.Remoting.Channels.BinaryServerFormatterSink.ProcessMessage(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream requestStream, IMessage& responseMsg, ITransportHeaders& responseHeaders, Stream& responseStream)

        Exception rethrown at [0]:

           at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)

           at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

      InnerException:

     

    I am very well aware that this is a .Net Framework version mismatch issue, because if I move the custom made assembly to .Net Framework v4.5 everything works fine. Unfortunately I am not allowed to do this due to requirement restrictions on the product.

     

    Any suggestion which would help overcome this problem would be highly appreciated.

     

    Thanks.


    • Edited by 96apko Tuesday, January 21, 2014 2:32 PM
    • Moved by Jane Wang - MSFT Wednesday, January 22, 2014 9:11 AM
    Tuesday, January 21, 2014 2:30 PM

All replies

  • Hello,

    Welcome to MSDN forum.

    This forum is mainly to discuss the Microsoft build engine aka MSBuild. Topics including: usage of MSBuild, build customization, and MSBuild extensibility via tasks, loggers and hosting.

    Since this issue is about WCF, I will move it to the related forum for better response.

    Thanks for your understanding.

    Sincerely,

    Jane.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, January 22, 2014 9:11 AM
  • Hi,

    It you really want your app to run in .NET4.5 runtime and be able to load 3.5 components. You should try following config file.

    <configuration>
        <startup useLegacyV2RuntimeActivationPolicy="true">
            <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
        </startup>
    </configuration>

    Also please try to check this thread:
    http://social.msdn.microsoft.com/Forums/vstudio/en-US/36b1a209-55d5-4323-91dc-0919ba2e1d03/using-methods-of-a-net-40-dll-by-net-35sp1-client?forum=clr .

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, January 23, 2014 9:16 AM
    Moderator
  • Hi Amy,

    Thanks for your suggestion. I tried it, but it did not help. What I did next was I rebuilt the problematic assemblies with .Net Framework 4.5 and argued an approval for it. However, I nevertheless find this problem very annoying and expect to run into it the next time there is a new framework version…

    Regards,

    Žarko


    • Edited by 96apko Thursday, January 23, 2014 9:29 AM
    Thursday, January 23, 2014 9:29 AM