实体框架资源文件不构建为构建脚本的一部分 [英] The Entity Framework resource files are not built as part of the build script
问题描述
我有一个批处理文件来构建一个ASP.NET Web应用程序项目,但它并没有在Core Compile进程中使用Entity Framework资源文件。
I have a batch file that builds an ASP.NET web application project, but it's not taking in the Entity Framework resource files in the Core Compile process.
构建脚本是:
set proj_name=MyProject
set proj_path=C:\...\path-to-project\
set pkg_name=MyProject.zip
set build_config=Release
set platform=AnyCPU
set msbuild=%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
%msbuild% "%proj_path%%proj_name%.csproj" /t:package /p:OutPath="%proj_path%obj" /p:OutputPath="%proj_path%bin" /p:Configuration=%build_config% /p:Platform=%platform%
虽然脚本完成没有错误,但网络应用程序崩溃与无法加载指定的元数据资源
错误。
While the script completes without errors, but the web app crash with Unable to load the specified metadata resource
error.
但是,如果我执行,一切都可以正常运行。所以我指出我的构建输出。
But if I do a Visual Studio Publish
, everything works fine. So that points me to look into my build output.
仔细比较 Visual Studio Publish
输出和我的构建脚本输出,我发现在 CoreCompile
部分, csdi
, msl $ c我的构建脚本输出中缺少$ c>和
ssdl
文件。但文件系统中的文件,以及解决方案
和 Project
的一部分。所以我不知道为什么它们在构建过程中不包括在内。下面是构建输出的一部分:
After carefully comparing the Visual Studio Publish
output and my build script output, I found in the CoreCompile
section, the csdi
, msl
and ssdl
files are missing from my build script output. But the files are there on the file system and part of the Solution
and Project
. So I'm not sure why they are not included during the build. Below, is part of the build output:
Visual Studio Publish输出:
Visual Studio Publish output:
/debug:pdbonly /optimize+ /out:obj\Release\Dnr.MotorPool.dll
/resource:obj\Release\edmxResourcesToEmbed\DataAccess\MyDataModel.csdl,DataAccess.MyDataModel.csdl
/resource:obj\Release\edmxResourcesToEmbed\DataAccess\MyDataModel.msl,DataAccess.MyDataModel.msl
/resource:obj\Release\edmxResourcesToEmbed\DataAccess\MyDataModel.ssdl,DataAccess.MyDataModel.ssdl
/target:library
/utf8output all the cs files...
我的构建脚本输出:
/debug:pdbonly /optimize+ /out:obj\Release\Dnr.MotorPool.dll
/target:library
/utf8output all the cs files...
很清楚,有3个丢失的文件。如何修改我的构建脚本?
So clearly, there are 3 missing files. How do I modify my build script then?
推荐答案
%msbuild% "%proj_path%%proj_name%.csproj" /T:Rebuild;Package
这篇关于实体框架资源文件不构建为构建脚本的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!