update MSBUILD to 17.6 that comes with the may 2023 update of .NET 7.0.302 SDK breaks build

huangapple go评论76阅读模式
英文:

update MSBUILD to 17.6 that comes with the may 2023 update of .NET 7.0.302 SDK breaks build

问题

自2023年5月16日晚以来,我们的Blazor解决方案构建失败。这是因为发布了新的.NET版本。这个版本是7.0.302,带来了新的MSBuild版本17.6,导致构建失败。

查看版本信息
https://learn.microsoft.com/en-us/dotnet/core/porting/versioning-sdk-msbuild-vs

在本地机器上升级到相同的SDK后,确实出现了相同的问题

> 无法从绑定属性中推断出属性名称
> 'bind-Model'。绑定属性应该是'bind'或
> 'bind-value'以及它们相应的可选参数,如
> 'bind-value:event'、'bind:format'等。

致敬

英文:

since the eveining of 16/5/2023 our builds of a blazor solution are failing. This happend because a new .NET version was released. This version 7.0.302 brings a new MSBuild version 17.6 and causes builds to fail

see versioning info
https://learn.microsoft.com/en-us/dotnet/core/porting/versioning-sdk-msbuild-vs

upgraded to same SDK on local machine, and indeed same problemen start to occure

> The attribute names could not be inferred from bind attribute
> 'bind-Model'. Bind attributes should be of the form 'bind' or
> 'bind-value' along with their corresponding optional parameters like
> 'bind-value:event', 'bind:format' etc.

Regards

答案1

得分: 1

我找到了一个临时解决方法,你可以在解决方案根目录的global.json中修复你的SDK。

{
  "sdk": {
    "version": "7.0.203",
    "rollForward": "disable",
    "allowPrerelease": false
  }
}

文档链接:https://learn.microsoft.com/en-us/dotnet/core/tools/global-json

另外请注意,当你修复了这个问题,并且你有Docker构建时,在你的Docker文件中也要指定一个固定的SDK版本。

FROM mcr.microsoft.com/dotnet/sdk:7.0.203 AS build
WORKDIR /src
英文:

I found a temporary workaround, you can fix your SDK in global.json in solution root

{
  "sdk": {
    "version": "7.0.203",
    "rollForward": "disable",
    "allowPrerelease": false
  }
}

documentation found on: https://learn.microsoft.com/en-us/dotnet/core/tools/global-json

also keep in mind when you fixed set this, and you have docker builds, also specify a fixed SDK in your docker file

FROM mcr.microsoft.com/dotnet/sdk:7.0.203 AS build
WORKDIR /src

huangapple
  • 本文由 发表于 2023年5月17日 16:31:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/76270044.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定