none
unbind BindAsLegacyV2Runtime RRS feed

  • Question

  • So we have an application launcher which can (should) run new apps created in clickOnce and older apps that use a remoting type of logic

    When trying to run the apps I received the following message

    Cannot load assembly. Error details: System.IO.FileLoadException: Could not load 
    file or assembly 'program' or one of its dependencies. Operation is not 
    supported.  (Exception from HRESULT: 0x80131515) File name:'program'  
    ---> System.NotSupportedException: An attempt was made to load an assembly from
    a network location which would have caused the assembly to be sandboxed in 
    previous versions of the .NET Framework. This release of the .NET Framework does 
    not enable CAS policy by default, so this load may be dangerous. If this load is 
    not intended to sandbox the assembly, please enable the loadFromRemoteSources 
    switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.

    Googling I found this piece of code which says update the app config

    Loading blocked and network-hosted assemblies with .NET 4

    That fix the older apps but now broke the newer apps

    So then I found Setting useLegacyV2RuntimeActivationPolicy At Runtime

    And this "works" in that if I load a new app first, no issue, then I load an older app and it is ok, but then if I go to load a new app it stops working.

    So either I need to know how to unbind BindAsLegacyV2Runtime when I am about to run new apps. Or I need a whole other approach?

    Thanks

    Friday, May 10, 2013 1:41 PM

Answers

  • Hi Mtiger,

    How about just set the loadFromRemoteSources configuration of the new apps?

    And what kind of launcher you are using?

    What does your older apps do?

    Thanks.


    Mike Feng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by mtiger Monday, May 13, 2013 6:11 PM
    Monday, May 13, 2013 8:23 AM
    Moderator

All replies

  • Hi Mtiger,

    How about just set the loadFromRemoteSources configuration of the new apps?

    And what kind of launcher you are using?

    What does your older apps do?

    Thanks.


    Mike Feng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by mtiger Monday, May 13, 2013 6:11 PM
    Monday, May 13, 2013 8:23 AM
    Moderator
  • That worked I added 

    <runtime>
         <loadFromRemoteSources enabled="true"/>
    </runtime>

    to the app.config.

    To answer your question, I don't know what kind of launcher the other one is using.  It is some kind of old remotting AppDomain.ExecuteAssembly

    Monday, May 13, 2013 6:30 PM