microsoft / service-fabric

Service Fabric is a distributed systems platform for packaging, deploying, and managing stateless and stateful distributed applications and containers at large scale.
https://docs.microsoft.com/en-us/azure/service-fabric/
MIT License
3.02k stars 399 forks source link

.Net Core 3.1, EF Core 3.1 publishing issues #449

Open aligneddev opened 4 years ago

aligneddev commented 4 years ago

I recently had a several day fight with a run-time exception. I lost way too much time on this :-), but have found a work around. I'm not sure if it is the best, but it works.

I'm hoping there is a fix that Microsoft can do to help others avoid the difficulties. I wasn't sure if this is the best place to create the issue. Azure Functions had some similar issues in their repo.

Here's a summary, more details can be found in my blog post

Visual Studio, right-click publish on the .sfproj worked great. The Azure DevOps pipeline release has this run-time exception.

System.PlatformNotSupportedException: Microsoft.Data.SqlClient is not supported on this platform. at Microsoft.Data.SqlClient.SqlConnection..ctor(String connectionString) at Microsoft.

My Solution I finally decided to go my own way. I know that dotnet publish got the right dll. I also learned that I couldn’t use dotnet cli to create a SF package. I created a .bat file to have something to run locally quickly. Then I moved that .bat file into the Azure DevOps build and called that. In the future, I may split it back out into separate build tasks.

I have the bat file in the blog post. Notice the steps.

aligneddev commented 4 years ago

It is important to note that the publishing in ADO .Net with the Visual Studio Build task (msbuild /t:packge) works with .Net Core 2.2. I haven't checked the differences in output between msbuild and dotnet publish for the Microsoft.Data.SqlClient.dll