locked
Error with enable migration in code first RRS feed

  • Question

  • User-1677868961 posted

    hi guys i started make web with asp.net mvc code first 

    i have a solution and 2 project 

    Datalayer and web project 

    now i need to enabled migration but i see this error :

    i try to :

    Enable-Migrations -force 

    and 

    Enable-Migrations -ProjectName DataLayer -ContextTypeName MyCMSContext

    but non of them is not work

    Monday, April 27, 2020 10:21 PM

All replies

  • User303363814 posted

    The error message says that you are loading from a network source and gives you a url to explain more about the problem.  Have you tried that?  What happened?

    Monday, April 27, 2020 10:40 PM
  • User-1677868961 posted
    1. i dont use network source in this project i just make 3 model in and 1 context class Datalayer project and nothing in main project
    2. yes i see document in microsoft web ( http://go.microsoft.com/fwlink/?LinkId=155569 ) but i cant fix this problem with it
    Monday, April 27, 2020 10:45 PM
  • User303363814 posted

    i cant fix this problem with it
    Any more detail available?  Why?

    Have you checked each of the referenced assemblies as the article that the large purple box links to suggests you do?

    What assemblies does 'DataLayer' reference?  It would seem that one of them has been downloaded from somewhere.

    Make a note of the location of all the referenced assemblies.  Close Visual Studio.  Use Explorer to get the properties of each of the assemblies that you noted.  If they are blocked then click the 'Unblock' button.

    I have had this sort of problem in the past and it can be quite a pain because it is not necessarily one of the directly referenced assemblies.  It could be one that they, in turn reference.  My memory (it was a long time ago and I am old) was that I ended up installing and running process explorer to see exactly which files are being touched and which one causes the problem.

    This tool may also be useful https://docs.microsoft.com/en-us/dotnet/framework/tools/fuslogvw-exe-assembly-binding-log-viewer

    Tuesday, April 28, 2020 4:53 AM
  • User1686398519 posted

    Hi,  unloadble

    I checked your error message and found this.

    Therefore,according to the error message you gave, you can add the following code in the configuration file:

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

    You can refer to this document for more information.
    https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/runtime/loadfromremotesources-element

    Best Regards,

    YihuiSun

    Wednesday, April 29, 2020 2:52 AM