问题
I have several modules in my XAF Winforms application. The lowest tier makes use of Entity Framework 6.2 as installed by Nuget.
The app runs fine in debug mode.
However in release mode I get the following warning building.
Severity Code Description Project File Line Suppression State
Warning Could not resolve this reference. Could not locate the assembly
"EntityFramework.SqlServer". Check to make sure the assembly exists on disk.
If this reference is required by your code, you may get compilation errors.
SBD.JobTalk.Workflow.Module.Win C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets 2110
At run time this turns into
Application: SBD.JobTalk.Workflow.Win10.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.FileNotFoundException
at SBD.JobTalk.Workflow.Module.WorkflowModule..cctor()
Exception Info: System.TypeInitializationException
at SBD.JobTalk.Workflow.Module.WorkflowModule..ctor()
at SBD.JobTalk.Workflow.Win.WorkflowWindowsFormsApplication.InitializeComponent()
at SBD.JobTalk.Workflow.Win.WorkflowWindowsFormsApplication..ctor()
at SBD.JobTalk.Workflow.Win.Program.Main()
I am using Framework 4.7.2 and Desktop Bridge Entity Framework is using Code First. The start up project is packages
I do not get the problem in a new XAF application created by the Dev Express XAF wizard.
I am making use of a shared project with inspiration from this blog
The problem goes away if I add Entity Framework reference to the Module.Win, Win and Win10 projects
Perhaps it is just an issue with shared projects?
回答1:
It seems Entity Framework needs to be referenced in all the tiers.
来源:https://stackoverflow.com/questions/53770437/entityframework-sqlserver-missing-in-release-mode