You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure DevOps中.NET 6/7构建测试失败:缺少AssemblyVersion参数

.NET 6/7构建错误MSB4044:缺少AssemblyVersion参数的解决方法

错误信息

C:\hostedtoolcache\windows\dotnet\sdk\7.0.200\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(197,5): error MSB4044: The "GenerateDepsFile" task was not given a value for the required parameter "AssemblyVersion". [D:\a\1\s\src\common\xxxxxxxx\xxxxxxxx.csproj]

解决方法

  • 直接在项目文件中配置版本属性
    打开报错的.csproj文件,添加包含版本信息的属性组:

    <PropertyGroup>
      <AssemblyVersion>1.0.0.0</AssemblyVersion>
      <FileVersion>1.0.0.0</FileVersion>
      <Version>1.0.0</Version>
    </PropertyGroup>
    

    版本号可根据项目实际需求调整。

  • 用Directory.Build.props统一管理版本
    若解决方案下有多个项目,可在根目录创建Directory.Build.props文件,写入上述版本属性组,所有子项目会自动继承该配置,避免重复设置。

  • 检查CI/CD构建命令参数
    如果是在CI/CD流程中触发的错误,确认构建命令是否传递了版本参数。比如在构建时添加/p:AssemblyVersion=1.0.0.0这类参数,明确指定版本值。

  • 排查自定义MSBuild配置
    若项目中存在自定义的MSBuild目标或扩展脚本,检查是否有逻辑意外清空了AssemblyVersion属性,导致GenerateDepsFile任务无法获取必填的参数值。

内容的提问来源于stack exchange,提问作者Dinesh

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.28 01:45:18