Link to home
Start Free TrialLog in
Avatar of curiouswebster
curiouswebsterFlag for United States of America

asked on

EF5 How do I stop pre-compiled views?

I am having a terrible bug involving pre-compiled views.

Here is the inner exception...

InnerException = {"The mapping and metadata information for EntityContainer 'MyContext' no longer matches the information used to create the pre-generated views."}

I use VS 2016.

So, I installed EFPowerTools and used the newly installed option:

In Solution Explorer, Right click MyContext.edmx
select: Entity Framework > Generate Views

I see a new file is created:
MyContext.View.cs

and added to the project

I run the program and get the same exception. Why?

I follow these instructions but did not write any new code as this MSDN post suggests...

https://msdn.microsoft.com/en-us/data/dn469601.aspx


Can I disable pre-compiled views? At the moment, I am okay with slower performance.

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of EugeneZ
EugeneZ
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of curiouswebster

ASKER

I had read that article already...

> To improve performance I have pre-compiled the views that EF normally generates at runtime. This works fine when I run locally or publish to our test server from visual studio

I am running locally and should have no need to pre-generated views, I would think.

I tried it both with the MyContext.View.cs being added to the project via EFPowerTools and with it deleted. Both got the same error.
What are the pre-compiled View filename extensions? Maybe I can delete them manually? Or is MyContext.View.cs considered a pre-compiled view?

Also from the article you posted "It's near certainty that it's writable on your development workstation"

I did verify the folder is writable and even opened VS 2015 as an Admin. And by the fact that the MyContext.View.cs files exists, I assume there are no folder write permissions issues at play here.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Good idea, to look at Razor pre-compilation.

Attached at my settings...

User generated image
I tried all three choice for "Copy to Output Directory" but all three failed the same way.
try to set build action to none ..
That created the following exception:

Message = "Unable to load the specified metadata resource."
thanks