I have a preexisting ASP.NET Core 3.0 application which is successfully deployed to an Azure App Service (using the AspNetCoreModuleV2
module). After upgrading the app to (today's release of) ASP.NET Core 3.1, the application builds and runs correctly on my local version of IIS Express. When I attempt to publish to the Azure App Service using (today's release of) Visual Studio 16.4, however, I receive the following error:
Assets file 'C:\Project\obj\project.assets.json' doesn't have a target for '.NETCoreApp,Version=v3.0'. Ensure that restore has run and that you have included 'netcoreapp3.0' in the TargetFrameworks for your project.
Notes
- All
<PackageReference>
's toMicrosoft.AspNetCore
,Microsoft.EntityFrameworkCore
, andMicrosoft.Extensions
have been updated to3.1.0
- I have cleaned my solution, and even nuked my
obj
folder to ensure there aren't any lingering references. - This error is being generated from the
3.1.100
version ofMicrosoft.PackageDependencyResolution.targets
.
I get that something is still hanging onto the .NET Core 3.0 dependencies. But it's unclear why that's only causing problems during deployment. Are Azure App Service's not yet ready for .NET Core 3.1? Or is this an issue with the dependency resolution targets?
<TargetFramework>
setting in thepubxml
profile that Visual Studio relies on, which I spaced on. Oops! Changing that tonetcoreapp3.1
to match thecsproj
target resolves the immediate issue. (This introduces a new issue with Azure App Service itself tripping on the target, but that can probably be resolved by using a self-contained deployment, similar to the link you provided.) Thank you for pointing me in the right direction! – Jeremy Caney