After upgrading to my ASP.NET MVC 4 Developer Preview assemblies to the latest MVC 4 beta, the following exception occurs for my MVC 4 projects:
Could not load type 'System.Web.WebPages.DisplayModes' from assembly
'System.Web.WebPages, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35'.
...
Exception Details: System.TypeLoadException: Could not load type
'System.Web.WebPages.DisplayModes' from assembly 'System.Web.WebPages,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
How do I fix this?
Update: I installed the new MVC 4 Beta NuGet package, which added most of the right assemblies, but now I get the missing DisplayModes error on compile:
The name 'DisplayModes' does not exist in the current context.
For the following piece of code in Global.asax.cs:
DisplayModes.Modes.Insert(0, new DefaultDisplayMode("iPhone") { ... });
2nd Update: Solved.
The DisplayModes syntax has changed to:
DisplayModeProvider.Instance.Modes.Insert(0, new DefaultDisplayMode("iPhone")
{
...
});
Related
I have been working on Entity framework recently i'm facing some challenging like when attempt to run the migration command it will show this Error
"Could not load file or assembly 'Launch, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified"
please if can help with i will be appreciated a lot
in my case. I solved this error by correcting the spelling of my target project from where I was calling it in the extension of my services for the startup class.
In my case as well, the error was due to the project name being misspelt in my startup class within the ConfigureServices method.
public void ConfigureServices(IServiceCollection services)
{
Constants.connectionString = Configuration.GetConnectionString("DefaultConnection");
// Add framework services.
services.AddDbContext<AppDbContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"),
b => b.MigrationsAssembly("ProjectNameHereWasMisspelt")));
when importing the itineries using ESB 2.2 EsbImportUtil.exe following error is displayed
I have EnterpriseLibrary 5 installed and GAC contain EnterpriseLibrary 4.1 dll also.
The type initializer for 'Microsoft.Practices.ESB.Configuration.ConfigHelper' threw an exception.[A]Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection cannot be cast to [B]Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection. Type A originates from 'Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.Practices.EnterpriseLibrary.Common\5.0.414.0__31bf3856ad364e35\Microsoft.Practices.EnterpriseLibrary.Common.dll'. Type B originates from 'Microsoft.Practices.EnterpriseLibrary.Common, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.Practices.EnterpriseLibrary.Common\4.1.0.0__31bf3856ad364e35\Microsoft.Practices.EnterpriseLibrary.Common.dll'.
Thanks for the help
Have you made any changes to esb.config file. Added new orchestation, try removing it. I had similar issue; fixed by removing wrong configuration.
Check:-
http://social.msdn.microsoft.com/Forums/en-US/bf2446fd-87fb-462a-8b78-cde7026bfdf5/the-type-initialize-for-microsoftpracticesesbconfigurationconfighelper-threw-an-exception?forum=biztalkesb
Today I update my monodroid to the its last version. Before this my solution works fine but no I got this errors:
MyProjectPath\Classes\Presentation Layer\Class Override\ImageLoaderListener.cs(15,15): Error CS0012: The type 'Java.Lang.Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=c4c4237547e4b6cd'. (CS0012) (RPLAndroidApp)
and also this:
MyProjectPath\Class Override\ImageLoaderListener.cs(15,15): Error CS0012: The type 'Android.Runtime.IJavaObject' is defined in an assembly that is not referenced. You must add a reference to assembly 'Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=c4c4237547e4b6cd'. (CS0012) (RPLAndroidApp)
I tried to recompile my java library that I build by 'JavaBindingLibraryProject' and add them again to project but When I build them I get many errors.
I'm confused what should I do?
Rebuild all your projects with the new version of Mono for Android. You have to do this because of the changes in Assembly strongnames.
I want to use RazorMachine on my VS2012 MVC 4 .NET webapp, called "Haas2013".
Everything is working, until I hit a line where I actually call RazorMachine.
I keep getting this error:
error CS1704: An assembly with the same simple name 'haas2013, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null has already been imported.
Try removing one of the
references or sign them to enable side-by-side.
Line 25: RazorMachine rm = new RazorMachine();
-->Error here: Line 26: ITemplate template = rm.ExecuteContent(res.Body);
When looking into Debug/Windows/Symbols, I can see the DLL of my project "haas2013.dll" loaded twice.
haas2013.dll C:\Users\Reinhard\AppData\Local\Temp\Temporary ASP.NET Files\root\6224be98\f18ecea8\assembly\dl3\43249f4b\692c79c0_cd2ace01\haas2013.dll No Yes Symbols loaded. C:\Users\Reinhard\AppData\Local\Temp\Temporary ASP.NET Files\root\6224be98\f18ecea8\assembly\dl3\43249f4b\692c79c0_cd2ace01\haas2013.pdb 29 1.0.0.0 27.03.2013 10:30 05740000-057A0000 [3820] iisexpress.exe: Managed (v4.0.30319)
haas2013.dll E:\Arbeiten\haas2013\haas2013\haas2013\obj\Debug\haas2013.dll No Yes Symbols loaded. E:\Arbeiten\haas2013\haas2013\haas2013\obj\Debug\haas2013.pdb 84 1.0.0.0 27.03.2013 10:30 08F90000-08FF0000 [3820] iisexpress.exe: Managed (v4.0.30319)
Is this the source of the error, or is this the expected behaviour?
I am using IIS-Express.
I am trying to use the MySQL Database with the Entity Framework Version 4.1.0.0 and Mono 2.11.4 in a ASP.NET MVC 3 Project.
On my Local Windows system everything works great but when I publish it to my Ubuntu 12.04 LTS System I get a lot of errors.
First I get:
Could not load type 'System.Data.Entity.Infrastructure.DbUpdateException' from assembly 'EntityFramework, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
when I press F5 I get different errors every time the page refreshes:
Could not load type 'System.Data.Entity.Infrastructure.DbUpdateConcurrencyException' from assembly 'EntityFramework, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
Could not load type 'System.Data.Entity.Infrastructure.DbCompiledModel' from assembly 'EntityFramework, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
Could not load type 'System.Data.Entity.Infrastructure.ReplacementDbQueryWrapper`1[TElement]' from assembly 'EntityFramework, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
Could not load type 'MySql.Data.VisualStudio.Editors.SqlEditor' from assembly 'MySql.VisualStudio, Version=6.6.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d'.
Could not load type 'MySql.Data.VisualStudio.WebConfig.WebConfigDlg' from assembly 'MySql.VisualStudio, Version=6.6.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d'.
A type load exception has occurred.
The last error occurred when I try to use the database with this code:
using (var db = new DefaultContext())
{
db.Persons.Add(new Person() { Name = "hallo", Address = "bllaaa" });
db.SaveChanges();
var persons = db.Persons.ToList();
return View(persons);
}
Did anybody have a similar problem and solved it? I do not know what to do.
P.S.: I use Code First Migration
From my understanding, Mono is bundling the open source version of Entity Framework, which is essentially yet-to-be-released v6.
http://weblogs.asp.net/scottgu/archive/2012/07/19/entity-framework-and-open-source.aspx
So it would seem you can't target EF v4.x, since the code has likely undergone major changes. Although, if you discover that the seemingly missing types are still there, you could attempt to work around the issue with an assembly redirect (just search for bindingRedirect).
I know why this happend.
I installed the mono-fastcgi-server4 through apt-get after i installed mono from source. So i had 2 mono versions installed and the older one was active. (2.10.8)
And the Entity Framework seems totally useless to me because only the new EF6 works with a database but there arent any provider who suppot EF6 and work with mono.