我有一个基于Azure DevOps构建的asp.net核心应用程序。构建和测试工作正常。但是当执行发布时,出现此错误:
2018-10-04T13:34:04.3032611Z obj\release\netcoreapp2.1\FelicitasCustomerportal.AssemblyInfo.cs(10,12): error CS0579: Duplicate 'System.Reflection.AssemblyCompanyAttribute' attribute [D:\a\1\s\FelicitasCustomerportal\FelicitasCustomerportal.csproj]
2018-10-04T13:34:04.3039062Z obj\release\netcoreapp2.1\FelicitasCustomerportal.AssemblyInfo.cs(11,12): error CS0579: Duplicate 'System.Reflection.AssemblyConfigurationAttribute' attribute [D:\a\1\s\FelicitasCustomerportal\FelicitasCustomerportal.csproj]
2018-10-04T13:34:04.3047800Z obj\release\netcoreapp2.1\FelicitasCustomerportal.AssemblyInfo.cs(12,12): error CS0579: Duplicate 'System.Reflection.AssemblyFileVersionAttribute' attribute [D:\a\1\s\FelicitasCustomerportal\FelicitasCustomerportal.csproj]
2018-10-04T13:34:04.3047914Z obj\release\netcoreapp2.1\FelicitasCustomerportal.AssemblyInfo.cs(13,12): error CS0579: Duplicate 'System.Reflection.AssemblyInformationalVersionAttribute' attribute [D:\a\1\s\FelicitasCustomerportal\FelicitasCustomerportal.csproj]
2018-10-04T13:34:04.3047967Z obj\release\netcoreapp2.1\FelicitasCustomerportal.AssemblyInfo.cs(14,12): error CS0579: Duplicate 'System.Reflection.AssemblyProductAttribute' attribute [D:\a\1\s\FelicitasCustomerportal\FelicitasCustomerportal.csproj]
2018-10-04T13:34:04.3055163Z obj\release\netcoreapp2.1\FelicitasCustomerportal.AssemblyInfo.cs(15,12): error CS0579: Duplicate 'System.Reflection.AssemblyTitleAttribute' attribute [D:\a\1\s\FelicitasCustomerportal\FelicitasCustomerportal.csproj]
2018-10-04T13:34:04.3055295Z obj\release\netcoreapp2.1\FelicitasCustomerportal.AssemblyInfo.cs(16,12): error CS0579: Duplicate 'System.Reflection.AssemblyVersionAttribute' attribute [D:\a\1\s\FelicitasCustomerportal\FelicitasCustomerportal.csproj]
在笔记本和台式机上,我可以毫无问题地进行构建和发布。另外,由于我没有任何AssemblyInfo文件,对此我感到很困惑。
我的构建YAML如下:
resources:
- repo: self
queue:
name: Hosted VS2017
#Your build pipeline references the ‘BuildConfiguration’ variable, which you’ve selected to be settable at queue time. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it settable at queue time. See https://go.microsoft.com/fwlink/?linkid=865971
#Your build pipeline references the ‘BuildConfiguration’ variable, which you’ve selected to be settable at queue time. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it settable at queue time. See https://go.microsoft.com/fwlink/?linkid=865971
#Your build pipeline references the ‘BuildConfiguration’ variable, which you’ve selected to be settable at queue time. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it settable at queue time. See https://go.microsoft.com/fwlink/?linkid=865971
steps:
- task: DotNetCoreCLI@2
displayName: 'dotnet build'
inputs:
projects: '**/*.csproj'
arguments: '--configuration $(BuildConfiguration)'
- task: DotNetCoreCLI@2
displayName: 'Run Tests'
inputs:
command: test
projects: '**/*Tests*.csproj'
arguments: '--configuration $(BuildConfiguration)'
- task: DotNetCoreCLI@2
displayName: 'dotnet publish'
inputs:
command: publish
arguments: '--configuration $(BuildConfiguration) --output $(build.artifactstagingdirectory)'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
我试图将这些标签添加到csproj:
假 错误
但是随后我得到了关于azure的错误(本地仍然一切正常):Program.cs(11,28):错误CS0017:程序定义了多个入口点。
我也将它与其他管道(也为asp.net核心)进行了比较,无需上面的两个标签就可以正常工作。 这里有什么问题?
编辑:我发现使用Visual Studio Build时,“构建和部署”有效。