Skip to content

Version 2.0.0 causes error : MSB4801: The task factory "CodeTaskFactory" is not supported on the .NET Core version of MSBuild. #51

@ManfredLange

Description

@ManfredLange

Problem

We have a library project (SDK csproj file format) that targets net462. It uses PackageReference, not packages.config.

When we add nuget package microsoft.codedom.providers.dotnetcompilerplatform version 2.0.0 to this project it builds fine within VS2017 v15.7.3. However, we get the following error when compiling the project with command dotnet build from a command line (e.g. PowerShell):

error : MSB4801: The task factory "CodeTaskFactory" is not supported on the .NET Core version of MSBuild

The project also references package Microsoft.Net.Compilers version 2.8.2. PowerShell is version 5.1.17134.48. We have installed dotnet SDK version 2.1.300. This is reported both in VS and in the PowerShell. This is also the version we have in the solution's global.json file.

Steps To Reproduce

  1. Install .NET SDK 2.1 (v2.1.300)
  2. Using Visual Studio 2017, version 15.7.3, create empty solution
  3. Add a sample netstandard 2.0 class library, e.g. SampleLib.csproj
  4. Edit the csproj file to target net462 instead of netstandard2.0
  5. Add nuget package Microsoft.CodeDom.Providers.DotNetCompilerPlatform version 2.0.0
  6. Build project within VS => success
  7. Open Powershell in folder containing the csproj file
  8. Execute dotnet build SampleLib.csproj => build fails with the error reported in this issue

The only workaround we found is falling back to using msbuild instead of dotnet build. We would prefer the latter. Note that our actual project is one of a set of about 75 projects. All others build fine with dotnet build.

Is there a workaround / resolution for this? What else can we try/test to diagnose/resolve this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions