sdk: dotnet publish won't embed edmx resources
Steps to reproduce
- Create new ASP.NET Core Web Application (.NET Framework),
- Add new Project to solution (Visual C# > Windows Classic Desktop) and select Class Library (.NET Framework),
- Add EntityFramework 6.1.3 as a reference to previously added class library,
- Add new Item to class library (Visual C# Items > Data > ADO.NET Entity Data Model),
- Choose Model Contents -> EF Designer from database, select any of your database, also select that you want to use “Entity Framework 6.x”, and choose at least one table to include in your model, in this step VS will create EDMX file,
- Add reference to project “class library” from WebApplication,
- Build whole solution with Visual Studio, go to bin directory in Class Library folder, and open this library with any resource viewer (resedit, ILSpy), notice that few resources are embedded (*.msl, *.csdl, *.ssdl),
- Restore nuget packages “nuget restore Solution.sln” and publish solution with “dotnet publish Solution.sln”, go to bin directory in Class Library folder, and open this library with any resource viewer (resedit, ILSpy), notice that embedded resources are missing.
Expected behavior
“dotnet publish” and “MSBuild” should produce same libraries.
Actual behavior
Class library produced by “dotnet publish” is without embedded resources.
Environment data
dotnet --info output:
.NET Command Line Tools (1.0.4)
Product Information: Version: 1.0.4 Commit SHA-1 hash: af1e6684fd
Runtime Environment: OS Name: Windows OS Version: 6.3.9600 OS Platform: Windows RID: win81-x64 Base Path: C:\Program Files\dotnet\sdk\1.0.4
nuget output:
NuGet Version: 4.1.0.2450
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 1
- Comments: 18 (1 by maintainers)
I have tried to compare what is the difference between “dotnet msbuild” and “msbuild” itself. Bacause Microsoft says that both commands have the exact same capabilities. https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-msbuild
I was playing a bit with debugging “msbuild” regarding to this article: https://blogs.msdn.microsoft.com/visualstudio/2010/07/06/debugging-msbuild-script-with-visual-studio/.
I found that msbuild needs few additional files to run “EntityModelCodeGenerator” correctly. In msbuild instalation directory there are:
But I can’t find these two files in bundled (with dotnet SDK) version of msbuild. Maybe there are more missing files.
@QuantumHive Obviously people will have different assembly names and would change it as required. I was merely building off the comment by @lampersky of using the (correct) output from
msbuildthat has the embedded resources, which in my build definition was already run beforedotnet publishin order to build the solution and run the unit tests.