Error compiling pre-generated view in VS 2008 - entity-framework

I am created pre-generated views for my EDMX using VS 2008, .NET 3.5 and Entity framework.
I have generated using the t4 templates mentioned here and got my mymodel.views.cs file. It's around 40 mb is size.
Added the views.cs file to my web application and my web service. When i build the apps, the webservice would build without any error and i can get the WS to work. But, the build fails in the website with the error
error CS0234: The type or namespace
name 'Mapping' does not exist in the
namespace 'System.Data' (are you
missing an assembly reference?)
The System.Data assembly is referenced in both the projects and the version denotes .NET 2.0. Suspect something trivial i am missing here, but still clueless.
Any pointers would help!

Add a reference to System.Data.Entity.dll, which contains the System.Data.Mapping namespace.

Related

EF suddenly cannot be found

While working on my MVC 5 project, the main db reference seems to have been broken.
CS0246 The type or namespace 'IntranetEntities' could not be found
(are you missing a using directive or assembly reference?)
When I am in the Model.edmx, it will link to the SQL server and update.
What would cause my "IntranetEntities" db reference to be broken?
How can I re-establish it?

Building Autofac from sources

How to build Autofac from sources? I found only one deprecated wiki page.
I've tried to launch go.cmd (.NET Framework 4.0), but it failed with errors:
C:\Autofac\Autofac.csproj" (default target) (4) ->
(CoreCompile target) ->
Builder\MetadataConfiguration.cs(28,14): error CS0234: The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?)
[C:\Autofac\Core\Source\Autofac\Autofac.csproj] Features\LazyDependencies\LazyWithMetadataRegistrationSource.cs(28,14): error CS0234: The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?)
What I am doing wrong?
Autofac 3.0 has been updated so the core Autofac.dll is a Portable Class Library that targets multiple platforms. Portable Class Libraries don't have references to System assemblies so the missing System.Core reference is correct - it shouldn't be there. You should be able to use the Portable Class Library with .NET 4... or with Windows Store or Windows Phone 8 apps. I strongly recommend not modifying the references for the .csproj. You'll break that compatibility and inadvertently change the target profiles.
The wiki page on building from source has been deprecated because the instructions for building are in a readme right in the root of the source code. (That's mentioned on that deprecated wiki page - first line.) It explains all the prerequisite tools and commands required. If you follow the information in there, you should not have to modify anything to get the source to build.
If you aren't modifying the sources, I'm not sure why you'd need to rebuild the source to target .NET 4 specifically. It should just work. If you see something that isn't working, please file an issue about it on the Autofac site.
If you are modifying the source, the readme in there should get you building without messing with the project references.
It looks like the Autofac.csproj does not include a reference to system.core. See also this question and this bugreport. So can you try to add this to the Autofac.csproj file:
<ItemGroup>
<Reference Include="System.Core" />
</ItemGroup>
Possibly you also have to add other references, such as System.

LINQPad 4 unable to find EntityFramework

I'm trying to use LINQPad 4 (the latest beta) with Entity Framework POCO classes. I take the normal path of creating a new connection and then selecting "Entity Framework DbContext POCO(4.1) and then selecting my he assembly holding my classes. When I do so I get the following message
"Could not load file or assembly EntityFramework. Version=4.1.O.O,
Culture= neutral, PublicKeyToken=b77a5c561934e089 or one of its dependencies.
The system cannot find the file specified."
I'm able to load the assembly from my application just fine. What gives? It seems a bit different from the previous problem like this reported in the CTP.
I had the same problem today, this is how I solved it:
Apparently the LINQPad 4.36.3 requires in some way Entity Framework 4.2 :/
It was released last week: ADO.NET blog
What I did is:
Installed EF4.2 via NuGet
Rebuilt the project
Copied all my project .dll files to LINQPad folder (including the 4.2 EF.dll)
I read here that I need to add something to the LINQPad.exe.config file but it was already there..
[At this point I tried removing that assembly redirect and ran it against my 4.1 dll, did not work, was still looking for 4.2]
Closed VS and uninstalled EF4.1
Thats it, after that both my project is now running on 4.2 and LINQPad works as well.

Webconfig error with the site online

I'm trying to publish a web site.
The publication works perfectly, but when I try to access the address it returns me the following error:
Parser Error Message: Could not load
file or assembly
'Microsoft.Web.Helpers' or one of its
dependencies. This assembly is built
by a runtime newer than the currently
loaded runtime and cannot be loaded.
Source Error:
Line 293:
Line 294:
Line 295: Line 296:
Line
297:
Source File:
C:\Windows\Microsoft.NET\Framework\v2.0.50727\Config\web.config
Line: 295
Assembly Load Trace: The following
information can be helpful to
determine why the assembly
'Microsoft.Web.Helpers' 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].
This does not happen when I'm running on the local site.
The application was developed and Sql Server WebMatrix Compac 4
If you read the error message it says "Could not load file or assembly 'Microsoft.Web.Helpers' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded." If you then look at the version of the ASP.NET that this site is attempting to run under, it is ASP.NET Version:2.0.50727.4209.
Web Pages and the Web Helpers library need Version 4.0. Make sure the site targets the correct version of ASP.NET.
For missing assemblies a simple solution is to just bundle them with your project.
Go to your project -> references -> find this microsoft web helpers ref -> open the properties panel and set Copy Local to True
Edit: Also try setting assembly binding logging.
I suspect that your web.config is fine and that there is an assembly missing from your deployment.
You probably have to include microsoft.web.helpers in your deployment package or simply copy it to the bin folder.
You might find that there are other assemblies missing but you should be able to pick them off one by one.
There is a previous question Hosting WebMatrix Page
that lists all of the dlls you have to deploy and also suggests using Webdeploy

Telerik MVC Extensions deployment problem

I am writing a website which uses Telerik MVC Extensions, and am getting an error on my test server when I get no such error on my development PC.
The error is ...
Web.config(101): error CS0246: The type
or namespace name 'Telerik' could not
be found (are you missing a using
directive or an assembly reference?)
Here is the relevant line from the web.config file ...
<add namespace="Telerik.Web.Mvc.UI"/>
I have checked the bin folder on my test server and it does contain the Telerik.Web.Mvc.dll file. The test server is 2008R2.
Have I missed something really obvious here?
Do you have multiple applications in your website? In other words, do you have multiple web.config and bin folders?