I have an MVC5 project with EF6 and I am using two assemblies, one for the main website "Goods" with controllers membership stuff and the other, separate assembly "Goods.Models" with business domain and business logic, which is also using EF6 and connecting to the same MySQL database.
When I try to create a migration in the second assembly I get error:
System.TypeInitializationException:
The type initializer for 'System.Data.Entity.Migrations.DbMigrationsConfiguration`1' threw an exception. ---> System.InvalidOperationException:
The DbConfiguration type 'Goods.Setup.MySqlConfiguration, Goods' specified in the application config file could not be loaded.
Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260883 for more information. --->
OK so it can't find "Goods.Setup.MySqlConfiguration, Goods"
I have the config files in both assemblies, one from the main front end assembly "Goods":
<entityFramework codeConfigurationType="Goods.Setup.MySqlConfiguration, Goods">...
And the other in the "Goods.Models" assembly:
<entityFramework codeConfigurationType="Goods.Models.MySQLSetup.MySqlConfiguration, Goods.Models">...
I made sure I am selecting the Goods.Models assembly in the PM console, but the error indicates that the migration framework is looking at the config file of the "Goods" assembly.
How can I fix this.
Solved by adding -StartUpProjectName parameter like so:
add-migration -StartUpProjectName Goods.Models
It appears it's not enough to set the default project in PM console
Related
I'm trying to get the Codeunit 50000 in this zip file to work: https://kappiwebhosting.blob.core.windows.net/dynamcisis/2015/09/Json.zip
Found here: https://dynamics.is/?p=2303
C/AL Globals
I'm trying to get Dynamics Nav 2009 to recognize the NewtonSoft.Json.dll, but no matter which version i try, i get this error as soon i want to verify the DotNet variable "JsonTextReader"/"JsonTextWriter" when selecting the subtype.
.NET interop: exception occured, 'Could not load file or assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.'.
If i declare a new Test variable of type DonNet and click [...] to select it from scratch i got this error when trying to choose which assembly to use:
.NET interop: exception occured, 'Could not load file or assembly 'C:\Program Files (x86)\Microsoft Dynamics NAV\60\Classic\Add-ins\Newtonsoft.Json.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.'.
The Newtonsoft.Json.dll file is present ind the folder, and "Everyone" have full control to the folder as well as the file.
The Json.zip file contain a single Newtonsoft.Json.dll which i started out with. Same error. The i downloaded the https://github.com/JamesNK/Newtonsoft.Json/releases and tried all versions with the same result.
Why all this? Yes, the company i work for have decided to start using Shopify, and i need to write an interface for getting orders from Shopify etc.
I really cannot figure out why i can't get this to work. There are 3 other DotNet "variables" that's configured and works as intended with no errors.
So any advice is highly appreciated.
Thanx
Looking for help for some solutions on switching out the default data provider for the project from MS SQL to mySQL. Eventually with the intent of deploying the solution to Auruora on AWS.
After installing the nuget package I get something along the lines of :
System.TypeLoadException: Method 'Clone' in type 'MySql.Data.EntityFrameworkCore.Infraestructure.MySQLOptionsExtension' from assembly 'MySql.Data.EntityFrameworkCore, Version=6.10.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' does not have an implementation.
This lead me to believe that there is no .NET 2.0 Entity Framework Core extention that runs for MySQL. Do I have to rollback to a different version?
For EntityFrameworkCore, it's suggested to use Pomelo.EntityFrameworkCore.MySql.
You may refer to their Getting Started documentation.
A fellow member of the community has kindly summarised the essential steps here:
Put Pomelo.EntityFrameworkCore.MySql into the xxx.EntityFrameworkCore project's .csproj file (see step 2 in the Pomelo getting started guide)
In your xxxDbContextConfigurer class put builder.UseMySql(...) rather than builder.UseSqlServer(...)
Change the connection string found in the appsettings.json file in the xxx.Web.Host project
I have a ASP.Net website that connects to a MySQL data base to retrieve data. I have used NuGet to install mysql.data. Doing this added a Bin folder with the sql.data dll in it to my project. It added a reference in my web config file. and it added a packages.config to my project. All of this is expected i assume ? With these resources in place my website works when i run it from visual studio. The problem is when i upload it to a server i get the following error :
Server Error in '/' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not load file or assembly 'MySql.Data, Version=6.9.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The system cannot find the file specified.
Source Error:
An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Source File: d:\DZHosts\LocalUser\bman262\www.brandonsLoginTest.somee.com\riviera horticulture\web.config Line: 7
Assembly Load Trace: The following information can be helpful to determine why the assembly 'MySql.Data, Version=6.9.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' could not be loaded.
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].
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1069.1
This is saying it cant find the mysql.data reference right ? What am i doing wrong ?
Here are some pictures of my solution in visual studio and my web.config
Solution
Web.config
I am tearing my hair out over this, any help would be VERY appreciated
→ You will have to make sure that the same version is installed on the server where you are deploying your project.
→ If the server to which you are deploying your project is on 64 bit, you can enable 32 bit support for this site's application pool, if your dll requires 32 bit architecture.
For anyone using similar or the same host as me if you have this problem the solution was to convert the project file to an application on the server.
Parent application built using Umbraco 4.9.0.
Child application built using Blog Engine 2.8.
Am hosting this on IIS6, and am loading the website, my parent application is loading good but my blog is not loading and it is throwing the below error.
Server error in '\blog' Application.
Runtime error
I couldn't view the description of the error even after i make the customerror to "RemoteOnly"
But below is the error from Event Viewer.
Exception information:
Exception type: HttpException
Exception message: Could not load file or assembly 'System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
AM very sure the parent application is inheriting and causing the above error, but i could fix it :( please help!
Your help is very much appreciated by this lone fighter.
Please refer the following link for the answer of this question:
Could not load file or assembly 'System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, or one of its dependencies
One thing you will need to do is to tell Umbraco to ignore the /blog url. That way it won't try to process that route.
NOTE:
To do that find the "umbracoReservedPaths" key in the appSettings (in the web.config file). In the value add ",~/blog" to the end of the other paths.
Also, remember that virtual directories inherit the web.config settings from the website they are in. So you may need to add some 's to the web.config for BlogEngine to remove Umbraco things that it cannot or will not use.
Are they both running the same version of .net?
I am using MySQL with dotConnector from Devart. I'm trying to use the code-first with migrations that the library offers. It creates the migrations just fine, but when I try to call Update-Database in the package manager I'm getting this error
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileLoadException: Could not load file or assembly 'EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Digging through my reference list, I'm using EntityFramework 5.0.0.0 and am targeting the v4.5 framework. Why would this be asking for v4.4 of EF?
I set up two connection strings, one using the regular MySQL provider, the other using dotConnector's MySQL provider, it didn't make a difference which one my context used. I've tried removing and re-adding the EF reference.
I'm so lost on this I don't even know what other information to give to help get a constructive answer. So, if there is more information I should give to help get a better answer, please let me know.
I've found more information about dotConnect and it looks like the Migrations portion targets 4.4. Does this mean I need to use EF 4.4? Or can I have both somehow so the migration has what it needs and I can use EF 5.0 everywhere else?
EF 4.4 is .NET 4.0 version of EF 5.0. It looks like something in your project is targeting .NET 4.0 (or is built for .NET 4.0).