Giter Site home page Giter Site logo

Comments (7)

binki avatar binki commented on May 25, 2024

You probably have to update the version of Roslyn being pulled in. You might be able to specify in your project a newer version of Microsoft.Net.Compilers.Toolset.

from msbuild.sdk.systemweb.

Bouke avatar Bouke commented on May 25, 2024

I've added the latest version of that package, but the error remains.

    <PackageReference Update="Microsoft.Net.Compilers.Toolset" Version="4.0.1" />

from msbuild.sdk.systemweb.

CZEMacLeod avatar CZEMacLeod commented on May 25, 2024

The SDK pulls in

<PackageReference Include="Microsoft.Net.Compilers.Toolset" Version="3.8.0" PrivateAssets="All"/>

automatically - as well as

<PackageReference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" Version="3.6.0" />

unless you set the property ExcludeASPNetCompilers to true.

If you are using Microsoft.Build.CentralPackageVersions you can actually set these versions in your central packages file.

Because of the order, if you place it in your project file, I'm pretty sure your

    <PackageReference Update="Microsoft.Net.Compilers.Toolset" Version="4.0.1" />

happens before the include so there will be nothing to update at that point.
If you move that to Directory.Build.targets it should work though.

Alternatively use

<PropertyGroup>
    <ExcludeASPNetCompilers>true</ExcludeASPNetCompilers>
</PropertyGroup>
<ItemGroup>
    <PackageReference Include="Microsoft.Net.Compilers.Toolset" Version="4.0.1" PrivateAssets="All"/>
    <PackageReference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" Version="3.6.0" />
</ItemGroup>

I will also look at potentially updating the default version pulled in by the SDK to 4.0.1.

I'm not entirely sure if there is an updated version of the CodeDom Providers, which means the langversion available in your compiled pages might not support C# 10.

from msbuild.sdk.systemweb.

Bouke avatar Bouke commented on May 25, 2024

Using version 4.0.66 with <MicrosoftNetCompilersToolset_Version>4.0.1</MicrosoftNetCompilersToolset_Version> gets rid of that error 👍. Thank you for your time and investigation.


Sadly I'm running into another issue which I hoped to get rid off by switching to Sdk-style project in the first place. My project builds fine on Windows (old-style csproj), but fails to build on macOS/Mono with the following error. I don't understand why this happens as MyLibrary builds just fine.

Assembly 'MyLibrary' with identity 'MyLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'System.Net.Http' with identity 'System.Net.Http, Version=4.1.1.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

Warning MSB3277 : Found conflicts between different versions of "System.Net.Http" that could not be resolved.
There was a conflict between "System.Net.Http, Version=4.1.1.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
    "System.Net.Http, Version=4.1.1.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was chosen because it was primary and "System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was not.
    References which depend on "System.Net.Http, Version=4.1.1.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [/Users/bouke/.nuget/packages/system.net.http/4.3.4/ref/net46/System.Net.Http.dll].
        /Users/bouke/.nuget/packages/system.net.http/4.3.4/ref/net46/System.Net.Http.dll
          Project file item includes which caused reference "/Users/bouke/.nuget/packages/system.net.http/4.3.4/ref/net46/System.Net.Http.dll".
            System.Net.Http
    References which depend on "System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/4.8-api/System.Net.Http.dll].
        /Users/bouke/Developer/MyProject/MyLibrary/bin/Debug/net48/MyLibrary.dll
          Project file item includes which caused reference "/Users/bouke/Developer/MyProject/MyLibrary/bin/Debug/net48/MyLibrary.dll".
            /Users/bouke/Developer/MyProject/MyLibrary/bin/Debug/net48/MyLibrary.dll

from msbuild.sdk.systemweb.

slang25 avatar slang25 commented on May 25, 2024

That brings back some bad memories. I think this SO answer might help:
https://stackoverflow.com/a/51424880/2225808

from msbuild.sdk.systemweb.

Bouke avatar Bouke commented on May 25, 2024

Yes bad memories indeed. I thought I left those behind by migrating to PackageReference and auto binding redirects. And it has been working fine for years now on Windows (regular Framework 4.8).

Thanks for the suggestion. My project already has a transitive dependency on System.Buffers 4.5.1, and making that dependency explicit doesn't resolve the build warning. I suspect the bug is with Mono not resolving the System.Net.Http dependencies similar to framework v4.7.2 or 4.8, but I have yet to find proof of this.

from msbuild.sdk.systemweb.

CZEMacLeod avatar CZEMacLeod commented on May 25, 2024

@Bouke Since the update to 4.0.66 deals with the c#10 issue, do you mind closing this?
If there is something specific to the SDK which affects your binding redirects / package resolving process perhaps open a new issue about it.
It should be noted, that using this on Linux/Mac with Mono is not really a supported scenario for this SDK and you are in for many other difficulties I suspect.

from msbuild.sdk.systemweb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.