使用Rider的ReSharper构建选项构建.NET10.0 Azure Functions报错
问题:启用Rider ReSharper构建选项后Azure Functions项目构建失败
问题现象
不使用Rider的ReSharper构建选项(路径:Rider → 设置 → 构建、执行、部署 → 工具集和构建)时,项目构建完全正常;但启用该选项后,出现如下构建错误:
\...\obj\Debug\net10.0\win-x64\WorkerExtensions\obj\project.assets.json' doesn't have a target for 'net8.0'. Ensure that restore has run and that you have included 'net8.0' in the TargetFrameworks for your project.
项目的.csproj文件仅配置了.NET 10.0作为目标框架,无法理解为何构建时会自动生成以.NET 8.0为目标框架的WorkerExtensions.csproj文件。
最小复现步骤(MRE)
- 新建项目 → 选择Azure Functions模板 → 目标框架指定为10.0
- 执行构建操作
项目与环境详细信息
- 当前使用的.NET版本:10.0.102
- Rider指定的MSBuild版本:适用于.NET Framework的MSBuild 18.0.2+995a3dce4
生成的问题文件WorkerExtensions.csproj内容
<Project Sdk="Microsoft.NET.Sdk"> <ItemGroup> <PackageReference Include="Microsoft.NETCore.Targets" Version="3.0.0" PrivateAssets="all" /> <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.6.0" /> </ItemGroup> <Target Name="_VerifyTargetFramework" BeforeTargets="Build"> <!-- It is possible to override our TFM via global properties. This can lead to successful builds, but runtime errors due to incompatible dependencies being brought in. --> <Error Condition="'$(TargetFramework)' != 'net8.0'" Text="The target framework '$(TargetFramework)' must be 'net8.0'. Verify if target framework has been overridden by a global property." /> </Target> </Project>
dotnet --info命令输出
Environment variables: Not set global.json file: Not found
更多环境细节
JetBrains Rider 2025.3.3 Build #RD-253.31033.136, built on February 19, 2026 Source revision: 565764487c99e Runtime version: 21.0.10+1-b1163.108 amd64 (JCEF 137.0.17) VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Toolkit: sun.awt.windows.WToolkit Windows 11.0 .NET Core v9.0.11 x64 (Server GC) GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation Memory: 2048M Cores: 16 Registry: ide.experimental.ui=true find.in.files.split.actions=false find.in.files.split=false Non-Bundled Plugins: org.toml.lang (253.28294.334) com.jetbrains.space (253.31033.21) ru.adelf.idea.dotenv (253.31033.139) com.intellij.copyright (253.28294.325) com.chesterccw.excelreader (2025.12.2-243.253) unreal-link (2025.3.0.1708) me.lensvol.blackconnect (0.6.2) com.github.copilot (1.5.65-243) org.jetbrains.security.package-checker (253.31033.21) com.jetbrains.sqlproj (0.1.12) me.rafaelldi.aspire (1.9.5) com.intellij.resharper.azure (4.6.5)
内容的提问来源于stack exchange,提问作者FluidMechanics Potential Flows
相关产品推荐
相关产品推荐

