Is there a way how to run Azure Cloud Service Classic project with worker role that targets .netstandard2.0?
I have such project, but any time I try to build it I receive this error:
Severity Code Description Project File Line Suppression State Error Project 'C:\path\to\project\src\Frontend\Frontend.csproj' targets '.NETStandard,Version=v2.0'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.0'. UserDiscoveryService C:\Program Files\dotnet\sdk\2.0.2\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.Common.targets 87
I tried to set target framework inside ccproj, but it didn't helped me.
If you are not sure which version of . NET Standard you should target, go with 2.0 as it offers a balance of reach and APIs available for you to use. If your goal is to make your library usable for many frameworks as possible while gettings all the APIs you can from .
NET Standard 1.3 will be compatible with apps that target . NET Framework 4.6, . NET Core 1.0, Universal Windows Platform 10.0, and any other platform that supports .
Cloud Services (classic) is now deprecated for new customers and will be retired on August 31st, 2024 for all customers. New deployments should use the new Azure Resource Manager based deployment model Azure Cloud Services (extended support).
Azure is a cloud platform designed to simplify the process of building modern applications. Whether you choose to host your applications entirely in Azure or extend your on-premises applications with Azure services, Azure helps you create applications that are scalable, reliable, and maintainable.
Just in case anyone else encounters this, I got past this error by adding this line to the Project/PropertyGroup section of the cloud service .ccproj file:
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
e.g.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>2.9</ProductVersion>
<ProjectGuid>8c99xxxx-xxxx-xxxx-xxxx-xxxxxxxx273e</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MyCloudService</RootNamespace>
<AssemblyName>MyCloudService</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion> <!-- Added -->
<StartDevelopmentStorage>True</StartDevelopmentStorage>
<Name>CloudSheetCloudService</Name>
etc...
By default the cloud services project does not specify the framework (it doesn't need to) but something in MSBuild appears to be doing a version check between the cloud service and the web / worker roles and then failing the build.
Changing the tools version did not help.
As background - I have an old cloud service that references a 4.6.2 project that uses the new csproj style like this:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net462</TargetFramework>
</PropertyGroup>
</Project>
HTH. Mark.
Edit: The file to edit is the .ccproj not the .cproj file as previously stated.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With