Ein Treffpunkt für C#-Programmierer
Anonymous
Wie deaktiviere ich spezifische Warnungen im Azure -Pipeline -Build?
Post
by Anonymous » 02 Jun 2025, 19:57
Ich begegnet auf eine große Anzahl von Warnungen (insgesamt 179) während meines Azure DevOps -Pipeline -Builds, einschließlich: < /p>
CS0168: Variable Deklared, aber nie verwendet < /p>
CS0612: Verwendung von Veraltungsklassen < /p>
Diese Warnungen überladen die Build -Ausgabe und machen es schwieriger, sich auf tatsächliche Probleme zu konzentrieren. Ich möchte wissen, wie man diese spezifischen Warnungen entweder in der Pipeline YAML oder durch MSBuild -Einstellungen unterdrückt oder deaktiviert. src = "
https://i.sstatic.net/4afv1z3l.png"/ >
Code: Select all
parameters:
- name: environment
type: string
default: Development
values:
- Development
- Stage
pool:
vmImage: 'windows-latest'
# method 1
name: $(Date:yyyyMMdd)$(Rev:.r)-${{ parameters.environment }}
# Define external repositories as resources
resources:
repositories:
- repository: TankDevProUI
type: git
name: TankDevProUI
ref: develop
- repository: AutoAssemblyGenerator
type: git
name: AutoAssemblyGenerator
ref: develop # Branch to check out
- repository: TankDevProEngineDynamicLibrary
type: git
name: TankDevProEngineDynamicLibrary
ref: develop # Branch to check out
variables:
solution: '**/TankDevPro.sln'
buildPlatform: 'Any CPU'
buildConfiguration: ${{ parameters.environment }}
environmentName: ${{ parameters.environment }}
jobs:
- job: BuildAndPublish
steps:
- script: echo "##vso[build.addbuildtag]${{ parameters.environment }}"
displayName: 'Tag build with environment'
# Checkout the main repository (TankDevPro repo)
- checkout: self
submodules: true
fetchDepth: 0
displayName: 'Checkout Main Repository'
- checkout: TankDevProUI
fetchDepth: 0
displayName: 'Checkout TankDevProUI'
# Checkout the AutoAssemblyGenerator repository
- checkout: AutoAssemblyGenerator
fetchDepth: 0
displayName: 'Checkout AutoAssemblyGenerator' # Place it in a path that matches the .sln file's expectation
# Checkout the TankDevProEngineDynamicLibrary repository
- checkout: TankDevProEngineDynamicLibrary
fetchDepth: 0
displayName: 'Checkout TankDevProEngineDynamicLibrary' # Place it in a path that matches the .sln file's expectation
# Debug: List directory structure to verify project files
- script: |
dir D:\a\1\s /s
displayName: 'List directory contents'
# Install NuGet tool
- task: NuGetToolInstaller@1
displayName: 'Install NuGet'
# Authenticate with Azure Artifacts feed
- task: NuGetAuthenticate@1
displayName: 'Authenticate with Azure Artifacts'
# Restore NuGet packages for the solution
- task: NuGetCommand@2
displayName: 'Restore NuGet packages'
inputs:
command: 'restore'
restoreSolution: '$(solution)'
feedsToUse: 'config'
nugetConfigPath: 'TankDevProUI/NuGet.config'
# Build the solution with SlowCheetah transformations for the specified environment
- task: MSBuild@1
displayName: 'Build solution for $(environmentName)'
inputs:
solution: '$(solution)'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
msbuildArguments: '/t:AutoAssemblyGenerator:Clean;TankDevProEngineDynamicLibrary:Clean;TankDevProUI:Clean;AutoAssemblyGenerator;TankDevProEngineDynamicLibrary;TankDevProUI /p:UseWPP=True /p:TransformOnBuild=true /p:Environment=$(environmentName)'
clean: false
# Step 6: Copy the Transformed Config Files to the Artifact Staging Directory
# - task: CopyFiles@2
# displayName: 'Copy Transformed Config Files'
# inputs:
# SourceFolder: '$(Build.SourcesDirectory)/TankDevProUI/bin/$(buildConfiguration)'
# Contents: '**/*.config'
# TargetFolder: '$(Build.ArtifactStagingDirectory)/config'
- task: CopyFiles@2
displayName: 'Copy Transformed Config Files'
inputs:
SourceFolder: '$(Build.SourcesDirectory)/TankDevProUI/bin/$(buildConfiguration)'
Contents: '**/*.config'
TargetFolder: '$(Build.ArtifactStagingDirectory)/bin'
- task: CopyFiles@2
displayName: 'Copy Build Output'
inputs:
SourceFolder: '$(Build.SourcesDirectory)/TankDevProUI/bin/$(buildConfiguration)'
Contents: |
**/*.dll
**/*.exe
**/*.json
**/*.config # Exclude config files since they were copied in the previous step
TargetFolder: '$(Build.ArtifactStagingDirectory)/bin'
# Publish build artifacts
- task: PublishBuildArtifacts@1
displayName: 'Publish artifacts for $(environmentName)'
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: 'TankDevPro'
publishLocation: 'Container'
# Deployment job to associate the pipeline run with the selected environment
- deployment: TrackEnvironment
dependsOn: BuildAndPublish
environment: ${{ parameters.environment }}
strategy:
runOnce:
deploy:
steps:
- script: echo "Pipeline completed for ${{ parameters.environment }} environment"
displayName: 'Log [url=viewtopic.php?t=25360]Environment[/url] Completion'
1748887031
Anonymous
Ich begegnet auf eine große Anzahl von Warnungen (insgesamt 179) während meines Azure DevOps -Pipeline -Builds, einschließlich: < /p> CS0168: Variable Deklared, aber nie verwendet < /p> CS0612: Verwendung von Veraltungsklassen < /p> Diese Warnungen überladen die Build -Ausgabe und machen es schwieriger, sich auf tatsächliche Probleme zu konzentrieren. Ich möchte wissen, wie man diese spezifischen Warnungen entweder in der Pipeline YAML oder durch MSBuild -Einstellungen unterdrückt oder deaktiviert. src = "https://i.sstatic.net/4afv1z3l.png"/> [code]parameters: - name: environment type: string default: Development values: - Development - Stage pool: vmImage: 'windows-latest' # method 1 name: $(Date:yyyyMMdd)$(Rev:.r)-${{ parameters.environment }} # Define external repositories as resources resources: repositories: - repository: TankDevProUI type: git name: TankDevProUI ref: develop - repository: AutoAssemblyGenerator type: git name: AutoAssemblyGenerator ref: develop # Branch to check out - repository: TankDevProEngineDynamicLibrary type: git name: TankDevProEngineDynamicLibrary ref: develop # Branch to check out variables: solution: '**/TankDevPro.sln' buildPlatform: 'Any CPU' buildConfiguration: ${{ parameters.environment }} environmentName: ${{ parameters.environment }} jobs: - job: BuildAndPublish steps: - script: echo "##vso[build.addbuildtag]${{ parameters.environment }}" displayName: 'Tag build with environment' # Checkout the main repository (TankDevPro repo) - checkout: self submodules: true fetchDepth: 0 displayName: 'Checkout Main Repository' - checkout: TankDevProUI fetchDepth: 0 displayName: 'Checkout TankDevProUI' # Checkout the AutoAssemblyGenerator repository - checkout: AutoAssemblyGenerator fetchDepth: 0 displayName: 'Checkout AutoAssemblyGenerator' # Place it in a path that matches the .sln file's expectation # Checkout the TankDevProEngineDynamicLibrary repository - checkout: TankDevProEngineDynamicLibrary fetchDepth: 0 displayName: 'Checkout TankDevProEngineDynamicLibrary' # Place it in a path that matches the .sln file's expectation # Debug: List directory structure to verify project files - script: | dir D:\a\1\s /s displayName: 'List directory contents' # Install NuGet tool - task: NuGetToolInstaller@1 displayName: 'Install NuGet' # Authenticate with Azure Artifacts feed - task: NuGetAuthenticate@1 displayName: 'Authenticate with Azure Artifacts' # Restore NuGet packages for the solution - task: NuGetCommand@2 displayName: 'Restore NuGet packages' inputs: command: 'restore' restoreSolution: '$(solution)' feedsToUse: 'config' nugetConfigPath: 'TankDevProUI/NuGet.config' # Build the solution with SlowCheetah transformations for the specified environment - task: MSBuild@1 displayName: 'Build solution for $(environmentName)' inputs: solution: '$(solution)' platform: '$(buildPlatform)' configuration: '$(buildConfiguration)' msbuildArguments: '/t:AutoAssemblyGenerator:Clean;TankDevProEngineDynamicLibrary:Clean;TankDevProUI:Clean;AutoAssemblyGenerator;TankDevProEngineDynamicLibrary;TankDevProUI /p:UseWPP=True /p:TransformOnBuild=true /p:Environment=$(environmentName)' clean: false # Step 6: Copy the Transformed Config Files to the Artifact Staging Directory # - task: CopyFiles@2 # displayName: 'Copy Transformed Config Files' # inputs: # SourceFolder: '$(Build.SourcesDirectory)/TankDevProUI/bin/$(buildConfiguration)' # Contents: '**/*.config' # TargetFolder: '$(Build.ArtifactStagingDirectory)/config' - task: CopyFiles@2 displayName: 'Copy Transformed Config Files' inputs: SourceFolder: '$(Build.SourcesDirectory)/TankDevProUI/bin/$(buildConfiguration)' Contents: '**/*.config' TargetFolder: '$(Build.ArtifactStagingDirectory)/bin' - task: CopyFiles@2 displayName: 'Copy Build Output' inputs: SourceFolder: '$(Build.SourcesDirectory)/TankDevProUI/bin/$(buildConfiguration)' Contents: | **/*.dll **/*.exe **/*.json **/*.config # Exclude config files since they were copied in the previous step TargetFolder: '$(Build.ArtifactStagingDirectory)/bin' # Publish build artifacts - task: PublishBuildArtifacts@1 displayName: 'Publish artifacts for $(environmentName)' inputs: pathToPublish: '$(Build.ArtifactStagingDirectory)' artifactName: 'TankDevPro' publishLocation: 'Container' # Deployment job to associate the pipeline run with the selected environment - deployment: TrackEnvironment dependsOn: BuildAndPublish environment: ${{ parameters.environment }} strategy: runOnce: deploy: steps: - script: echo "Pipeline completed for ${{ parameters.environment }} environment" displayName: 'Log [url=viewtopic.php?t=25360]Environment[/url] Completion' [/code]
0 Replies
19 Views
Last post by Guest
13 Feb 2025, 11:23
0 Replies
6 Views
Last post by Anonymous
15 Feb 2025, 08:01
0 Replies
19 Views
Last post by Guest
12 Feb 2025, 06:48
0 Replies
8 Views
Last post by Guest
12 Feb 2025, 06:48
0 Replies
19 Views
Last post by Anonymous
05 Apr 2025, 19:32