-
Notifications
You must be signed in to change notification settings - Fork 47
Description
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
- Install .NET SDK 2.1 (v2.1.300)
- Using Visual Studio 2017, version 15.7.3, create empty solution
- Add a sample netstandard 2.0 class library, e.g.
SampleLib.csproj - Edit the csproj file to target
net462instead ofnetstandard2.0 - Add nuget package
Microsoft.CodeDom.Providers.DotNetCompilerPlatformversion 2.0.0 - Build project within VS => success
- Open Powershell in folder containing the csproj file
- 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?