繁体   English   中英

Azure 云服务项目与 new.csproj 格式的 Worker Role 项目不兼容

[英]Azure Cloud Service Project Not Compatible With Worker Role Project in new .csproj format

我们正在尝试升级我们现有的 Azure Worker Role 项目以针对 .NET 4.7.2,并将我们解决方案中的所有依赖项目重新定位到 .NET 标准 2.0,因为我们完全消除了 Worker 这个项目的中间步骤。迁移到 Docker 容器中托管的 .NET Core 3.0 Worker Service。

我们解决方案中的所有项目文件 ( .csproj ) 都已转换为“新”格式,我们已经消除了packages.config并且一切正常。 几乎。

我们剩下的一个障碍是尝试构建我们的 Azure 云服务项目(为 Azure 生成打包工作角色文件的.ccproj文件)。 尝试构建云服务项目会导致Microsoft.Common.CurrentVersion.targets的第 1653 行出现错误:

项目foonet472目标。 .NETFramework, Version=v4.0为目标的项目不能引用它。

在这一点上,我们几乎被难住了。 我没有找到任何与新.csproj格式的工作角色项目相关的特定错误的引用。

I tried leaving the Worker Role project in the "old" project file format and targeting it to .NET 4.7.2 and the Azure Cloud Service project builds just fine -- except that NuGet package references from the dependent .NET Standard projects in our solution are not properly resolved and the NuGet package DLLs are not propagated to the build output folder - from what I've read, that's because the "new" project format method of referencing NuGet packages is not compatible with the old packages.config format. 由于在运行时会出现新的缺失依赖项,因此我不得不一次向 Worker Role 项目手动添加一个 NuGet package。 当我们在项目中使用近 100 个 NuGet 包时,显然不是一个好的解决方案。

从以下找到: Azure Cloud Service Classic with .NET 标准目标

在 .ccproj 文件中添加以下行为我修复了它:

    <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM