dotnet publish won't embed edmx resources
See original GitHub issueSteps 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
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:18 (1 by maintainers)
Top Results From Across the Web
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...
Read more >MetadataException: Unable to load the specified metadata ...
I had moved my EDMX file to another folder and had to change the build action to get the embedded resource names to...
Read more >MSBuild reference for .NET SDK projects
This property is useful if you run dotnet publish on a solution file, as it allows automatic selection of projects that should be...
Read more >Troubleshoot ASP.NET Core Localization
In this article. Localization configuration issues; Resource file naming issues; Missing resources; Resources & Class Libraries issues ...
Read more >dotnet publish command - .NET CLI
Name. dotnet publish - Publishes the application and its dependencies to a folder for deployment to a hosting system.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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
msbuild
that has the embedded resources, which in my build definition was already run beforedotnet publish
in order to build the solution and run the unit tests.