Debug / Relase in Visual studio and missing embeded files

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
KW
Posts: 125
Joined: Tue 19 Feb 2008 19:12

Debug / Relase in Visual studio and missing embeded files

Post by KW » Wed 26 Jul 2017 21:51

I have a EFmodels class library project that targets .net47. In it is a EF6.edml file that can be edited with Entity Developer.

This works perfect in Debug mode but if you put the Project into release mode it no longer will embed the csdl, ssdl and msl files.

You can verify that the EFModels.dll in the debug folder is over 200kb larger than the one in the release folder.

Is this something that can be specified with Entity Developer? Or something I can change in visual studio?

Shalex
Site Admin
Posts: 8247
Joined: Thu 14 Aug 2008 12:44

Re: Debug / Relase in Visual studio and missing embeded files

Post by Shalex » Thu 27 Jul 2017 15:31

KW wrote:This works perfect in Debug mode but if you put the Project into release mode it no longer will embed the csdl, ssdl and msl files.
Why did you decide so? Are you getting any error? If so, specify the exact text of the error and its full stack trace. Also please use some decompiler (e.g.: JustDecompile) and check if the resources *.csdl, *.msl, *.ssdl are embedded to the result assembly in Release Mode.
KW wrote:You can verify that the EFModels.dll in the debug folder is over 200kb larger than the one in the release folder.
The size difference is designed: https://stackoverflow.com/questions/533 ... tudio-2010.

KW
Posts: 125
Joined: Tue 19 Feb 2008 19:12

Re: Debug / Relase in Visual studio and missing embeded files

Post by KW » Thu 27 Jul 2017 22:09

Code: Select all

Unable to load the specified metadata resource.


   at System.Data.Entity.Core.Metadata.Edm.MetadataArtifactLoaderResource.LoadResource()
   at System.Data.Entity.Core.Metadata.Edm.MetadataArtifactLoaderResource.CreateReader()
   at System.Data.Entity.Core.Metadata.Edm.MetadataArtifactLoaderResource.CreateReaders(DataSpace spaceToGet)
   at System.Data.Entity.Core.Metadata.Edm.MetadataArtifactLoaderComposite.CreateReaders(DataSpace spaceToGet)
   at System.Data.Entity.Core.Metadata.Edm.MetadataCache.LoadEdmItemCollection(MetadataArtifactLoader loader)
   at System.Data.Entity.Core.Metadata.Edm.MetadataCache.<>c__DisplayClass5.<GetMetadataWorkspace>b__0(String k)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at System.Data.Entity.Core.Metadata.Edm.MetadataCache.GetMetadataWorkspace(String cacheKey, MetadataArtifactLoader artifactLoader)
   at System.Data.Entity.Core.Metadata.Edm.MetadataCache.GetMetadataWorkspace(DbConnectionOptions effectiveConnectionOptions)
   at System.Data.Entity.Core.EntityClient.EntityConnection.GetMetadataWorkspace()
   at System.Data.Entity.Core.Objects.ObjectContext.RetrieveMetadataWorkspaceFromConnection()
   at System.Data.Entity.Core.Objects.ObjectContext..ctor(EntityConnection connection, Boolean isConnectionConstructor, ObjectQueryExecutionPlanFactory objectQueryExecutionPlanFactory, Translator translator, ColumnMapFactory columnMapFactory)
   at System.Data.Entity.Internal.InternalConnection.CreateObjectContextFromConnectionModel()
   at System.Data.Entity.Internal.LazyInternalConnection.CreateObjectContextFromConnectionModel()
   at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
   at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
   at System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
   at System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()
   at System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider()
   at System.Linq.Queryable.Select[TSource,TResult](IQueryable`1 source, Expression`1 selector)
   at MeridianCondoResortsWebAPI.v1.Controllers.HKController.GenerateCheckInOutSheet(DateTime Day)
   at lambda_method(Closure , Object , Object[] )
   at Microsoft.AspNetCore.Mvc.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionMethodAsync>d__27.MoveNext()

The telerik decompiler has the following in the debug:

Project Creation:
============================
1.EF6.ssdl
2.EF6.csdl
3.EF6.msl

These files are NOT in the release build.

It's definitive - the release build is not publishing the embedded files.

Shalex
Site Admin
Posts: 8247
Joined: Thu 14 Aug 2008 12:44

Re: Debug / Relase in Visual studio and missing embeded files

Post by Shalex » Fri 28 Jul 2017 14:59

We cannot reproduce the issue in our environment. Please specify:
1) the exact version (x.x.x) of your dotConnect for MySQL via Visual Studio > Tools > MySQL > About
2) the version and edition of your Visual Studio via Help > About
3) right click your project in Solution Explorer > Properties > the Build tab, send us a screenshot of settings in this window

KW
Posts: 125
Joined: Tue 19 Feb 2008 19:12

Re: Debug / Relase in Visual studio and missing embeded files

Post by KW » Mon 31 Jul 2017 18:07

Image
Image
Image

Shalex
Site Admin
Posts: 8247
Joined: Thu 14 Aug 2008 12:44

Re: Debug / Relase in Visual studio and missing embeded files

Post by Shalex » Tue 01 Aug 2017 17:21

We still cannot reproduce the problem. Please create a brand new simple console application, add the *.edml model with one table to it, compile in the Release mode. If the issue persists in this case as well, zip and upload this project (with a compiled binaries) to ftp://ftp.devart.com (credentials: anonymous / yourEmail).

KW
Posts: 125
Joined: Tue 19 Feb 2008 19:12

Re: Debug / Relase in Visual studio and missing embeded files

Post by KW » Tue 01 Aug 2017 22:27

I think I may have created a .net standard class library to host the entity framework model. Can you try that project type?

Shalex
Site Admin
Posts: 8247
Joined: Thu 14 Aug 2008 12:44

Re: Debug / Relase in Visual studio and missing embeded files

Post by Shalex » Thu 03 Aug 2017 14:23

You created a .Net Core project, opened *.csproj and changed target framework to net461, added *.edml model (EF6), didn't you?

The ".NET Core with *.edml" scenario has two issues with a current build of dotConnect for MySQL:

1. "Custom Tool=DevartEfGenerator" (model property) doesn't generate any code. The bug with applying Custom Tool by Devart Entity Model (*.edml) in VS 2017 .NET Core projects is fixed in an upcoming new public build of dotConnect for MySQL. We will notify you when it is available for download.

2. "Build Action=DevartEntityDeploy" (model property) doesn't embed the resources (*.ssdl, *.msl, *.csdl) to the result assembly. We didn't find a way how to fix this issue. Also, we have checked a standard Microsoft EF Designer, it cannot embed resources as well. Similar problems:
https://github.com/dotnet/project-system/issues/2371
https://github.com/dotnet/project-system/issues/113
As a workaround, please use a fluent mapping, you can generate it with the DbContext template: http://blog.devart.com/entity-developer ... plate.html.

OR use .NET Framework project type with *.edml (EF6).
OR use .NET Core project type with *.efml (EF Core).
OR use .NET Framework project type with *.efml (EF Core).

Shalex
Site Admin
Posts: 8247
Joined: Thu 14 Aug 2008 12:44

Re: Debug / Relase in Visual studio and missing embeded files

Post by Shalex » Fri 04 Aug 2017 16:00

New build of dotConnect for MySQL 8.9.958 is available for download: viewtopic.php?f=2&t=35776.

Post Reply