fsprojects / fsprojects/Paket

Csc compiler error after upgrading to VS2015 Update 3 (order of import statements)

Open
#1,789 22 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug msbuild proj sdk: verbose sdk
Dominant language
F#
Stars
2.1k
Forks
528
Avg merge
1d 12m
Merged PRs (30d)
54

Description

Description

After upgrading to VS2015 Update 3 I noticed that some WebAPI projects targeting framework v4.6.1 were coming up with the following error:

Build FAILED.

       "D:\Code\my-project\src\WebApiProject.Tests.Unit\WebApiProject.Tests.Unit.csproj" (Build target) (1) ->
       "D:\Code\my-project\src\WebApiProject\WebApiProject.csproj" (default target) (5) ->
       (CoreCompile target) ->
         C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.CSharp.Core.targets(76,11): error MSB4064: The "ChecksumAlgorithm" paramete
       r is not supported by the "Csc" task. Verify the parameter exists on the task, and it is a settable public instance property. [
       D:\Code\my-project\src\WebApiProject\WebApiProject.csproj]
         C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.CSharp.Core.targets(67,5): error MSB4063: The "Csc" task could not be initi
       alized with its input parameters.  [D:\Code\my-project\src\WebApiProject\WebApiProject.csproj]
Repro steps

Paket orders the import statements like so;

  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <Choose>
    <When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.6.1' Or $(TargetFrameworkVersion) == 'v4.6.2')">
      <PropertyGroup>
        <__paket__Microsoft_Net_Compilers_props>Microsoft.Net.Compilers</__paket__Microsoft_Net_Compilers_props>
      </PropertyGroup>
    </When>
  </Choose>
  <Import Project="..\packages\Microsoft.Net.Compilers\build\$(__paket__Microsoft_Net_Compilers_props).props" Condition="Exists('..\packages\Microsoft.Net.Compilers\build\$(__paket__Microsoft_Net_Compilers_props).props')" Label="Paket" />
  <Choose>
    <When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.6.1' Or $(TargetFrameworkVersion) == 'v4.6.2')">
      <PropertyGroup>
        <__paket__Microsoft_CodeDom_Providers_DotNetCompilerPlatform_props>Microsoft.CodeDom.Providers.DotNetCompilerPlatform</__paket__Microsoft_CodeDom_Providers_DotNetCompilerPlatform_props>
      </PropertyGroup>
    </When>
  </Choose>
  <Import Project="..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform\build\$(__paket__Microsoft_CodeDom_Providers_DotNetCompilerPlatform_props).props" Condition="Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform\build\$(__paket__Microsoft_CodeDom_Providers_DotNetCompilerPlatform_props).props')" Label="Paket" />

Ordering them instead like this fixed the issue;

  <Choose>
    <When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.6.1' Or $(TargetFrameworkVersion) == 'v4.6.2')">
      <PropertyGroup>
        <__paket__Microsoft_Net_Compilers_props>Microsoft.Net.Compilers</__paket__Microsoft_Net_Compilers_props>
      </PropertyGroup>
    </When>
  </Choose>
  <Import Project="..\packages\Microsoft.Net.Compilers\build\$(__paket__Microsoft_Net_Compilers_props).props" Condition="Exists('..\packages\Microsoft.Net.Compilers\build\$(__paket__Microsoft_Net_Compilers_props).props')" Label="Paket" />
  <Choose>
    <When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.6.1' Or $(TargetFrameworkVersion) == 'v4.6.2')">
      <PropertyGroup>
        <__paket__Microsoft_CodeDom_Providers_DotNetCompilerPlatform_props>Microsoft.CodeDom.Providers.DotNetCompilerPlatform</__paket__Microsoft_CodeDom_Providers_DotNetCompilerPlatform_props>
      </PropertyGroup>
    </When>
  </Choose>
  <Import Project="..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform\build\$(__paket__Microsoft_CodeDom_Providers_DotNetCompilerPlatform_props).props" Condition="Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform\build\$(__paket__Microsoft_CodeDom_Providers_DotNetCompilerPlatform_props).props')" Label="Paket" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
Expected behavior

Microsoft.CSharp.targets is below that of the Net.Compilers and CodeDom.Providers prop imports.

Actual behavior

Microsoft.CSharp.targets is above that of the Net.Compilers and CodeDom.Providers prop imports.

Known workarounds

Move them manually and correct after each Paket update.

Related information

Paket version 3.4.0.0

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing Paket's generated project-file import ordering, using the shown WebApiProject.csproj sequence and the Microsoft.CSharp.targets, Microsoft.Net.Compilers, and Microsoft.CodeDom.Providers.DotNetCompilerPlatform imports. Reproduce the build with VS2015 Update 3 and confirm that Microsoft.CSharp.targets is emitted below the package property imports and the MSB4064/MSB4063 errors no longer occur.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.