Azure Cloud Service Classic with .NET Standard target Azure Cloud Service Classic with .NET Standard target azure azure

Azure Cloud Service Classic with .NET Standard target


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.


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'.

Based on the error, your Frontend.csproj project targets .NETStandard 2.0 and you referenced the .NETStandard 2.0 project from a project targets .NETFramework V4.0. As the official documentation about .NET Standard, you need to at least make your project targets .NETFramework V4.6.1 for referencing the .NETStandard 2.0 project or library. Or you need to choose the lower .NET Standard version, more details you need to follow .NET implementation support.