英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论