Search code examples
asp.net-coreiisentity-framework-corewebdeploy

Entity Framework Core - Web Deploy is Missing SQL Server Management Object Dependency


Currently I'm trying to do Web Deploy ASP.NET CORE Project which using EF Core to a Remote IIS Server, I checked this flag to perform EF Migration on Publish:

EF Migration

But unfortunately I got missing dependencies:

C:\Program Files\dotnet\sdk\8.0.304\Sdks\Microsoft.NET.Sdk.Publish\targets\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(140,5): Error : Web deployment task failed. (The SQL provider cannot run because of a missing dependency. Please make sure that Microsoft SQL Server Management Objects (Version 10 or higher) is installed.  Learn more at: https://go.microsoft.com/fwlink/?LinkId=221672#ERROR_SMO_NEEDED_FOR_SQL_PROVIDER.)
Publish failed to deploy.

I have tried to Install Following NUGET Package on my VS 2022 without success:

NUGET

I think the Database should be created automatically when I use this flag.


Solution

  • Thanks Steve Py, your answer has solved my problem.

    SMO needs to be installed on your web server and the IIS server may need permission adjustments to enable it to run migrations against the desired database. Normally SMO is installed with SQL Server, but with most web deployments that would be a different machine than the IIS web server. With migrations the database creation, etc. would be executed from the IIS server.