I recently upgraded to Visual Studio Community 2019 16.5.2. Our Blazor Server application’s solution comprises of several projects and all of them are targeted to .NET Core 3.1
When I am trying to publish my application from Visual Studio, I get the below error:
NU1201 Project GCB.Storage is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0) / win-x64. Project GCB.Storage supports: netcoreapp3.1 (.NETCoreApp,Version=v3.1)
Visual Studio says I get above error for project "GCB.Main" in GCB.Main.csproj. GCB.Main has a reference to the project GCB.Storage. Both of these projects’ target framework is set to .NET Core 3.1. I double checked all the dependencies and project references in both the projects and none of them depend on .NET Core 3.0
Microsoft documentation says that error might occur when "A dependency project doesn't contain a framework compatible with the current project. Typically, the project's target framework is a higher version than the consuming project."
Here are my publishing profile parameters in Visual Studio:
- Configuration: Debug
- Target framework: netcoreapp3.1
- Deployment mode: Framework-Dependent
- Target runtime: win-x64
I looked at control panel on the server where I am publishing and it has "Microsoft .NET Core SDK 3.1.201 (x64) from Visual Studio" update installed. Do I need to configure/install anything on the server? I do not see an entry for .NET Core Runtime 3.1 but I do see entries for MSFT .NET Core - 3.0.0 (x86), one for x64, and one for MSFT .NET Core 3.0.0 - Windows Server Hosting. Should I install .NET Core 3.1 runtime explicitly even though I installed Visual Studio 2019 16.5.2 on the same server?
Please note that I am able to compile/rebuild the solution without any errors on the same server where I am publishing it to. However when I try to publish I get above publishing errors.
Below is my pubxml
--
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<PublishProvider>FileSystem</PublishProvider>
<LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<TargetFramework>netcoreapp3.0</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<ProjectGuid>a2939d6d-c286-40c3-a015-e946d67cd806</ProjectGuid>
<SelfContained>false</SelfContained>
<publishUrl>C:\GCB</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
</PropertyGroup>
</Project>
--
Any pointers?
Thanks
dotnet build
anddotnet publish
from the cmdline to see if the issue is with the framework or with VS? – ESG-o <directory>
when publishing. As for why the VS profile isn't working, it's hard to tell without looking at the profile. Can you show yourpubxml
profile? – ESG