我一直在尝试解决由我的管道创建的drop不包含不同.csproj的{Assembly}.styles.css的问题。当我在本地发布时,它按预期工作,但在Azure管道上不工作。
我没有找到很多关于这方面的信息。有一个关于执行构建命令的Stackoverflow答案,但我希望有更简单/更好/内置的东西。
Yaml的详细信息(看起来很直接……我省略了测试和符号步骤(
steps:
- task: NuGetToolInstaller@1
displayName: 'Use NuGet 5.11.0'
inputs:
versionSpec: 5.11.0
checkLatest: true
- task: NuGetCommand@2
displayName: 'NuGet restore'
inputs:
restoreSolution: '$(Parameters.solution)'
- task: VSBuild@1
displayName: 'Build solution ***.sln'
inputs:
solution: '$(Parameters.solution)'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
- task: CopyFiles@2
displayName: 'Copy Files to: $(build.artifactstagingdirectory)Blazor*************'
inputs:
SourceFolder: '$(system.defaultworkingdirectory)'
TargetFolder: '$(build.artifactstagingdirectory)Blazor**************'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
condition: succeededOrFailed()
在日志中,我可以找到我无法真正理解的信息,比如:
跳过资产"D:\a\41\s\Blazor******\obj\Release \net6.0\scopedcss\bundle\Blazor******.styles.css",因为"复制到输出目录"选项为"从不">
已接受的候选资产"D:\a\41\s\ Blazor****\obj\ Release \net6.0 \scopedcss \ bundle\Brazor*******.styles.css",因为项目模式为"根",资产模式为"当前项目"正在跳过资产"D:\a\41\s\Blazor******\obj\Release \net6.0\scopedcss\bundle\Blazor******.styles.css",因为源类型为"Project">
有人知道吗?
谢谢:(
这是我使用blazor.net6在azure devops上构建的,并与作用域css一起工作。希望它能有所帮助(更改变量中的项目名称(。就我个人而言,由于构建任务,我必须先进行构建,然后发布,但您可能只需要使用dotnet发布(删除dotnet构建(
variables:
projectName: '**/ProjectName.csproj'
BuildConfiguration: 'Release'
steps:
- task: UseDotNet@2
displayName: 'Use .NET Core sdk 6.x'
inputs:
version: 6.x
- task: DotNetCoreCLI@2
displayName: Restore
inputs:
command: 'restore'
projects: $(projectName)
- task: DotNetCoreCLI@2
displayName: Build
inputs:
command: 'build'
projects: $(projectName)
arguments: '--configuration $(BuildConfiguration)'
- task: DotNetCoreCLI@2
displayName: Publish
inputs:
command: publish
publishWebProjects: false
projects: $(projectName)
arguments: '--configuration $(BuildConfiguration) --output "$(build.artifactstagingdirectory)"'
zipAfterPublish: true
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'