GitVersion: [Bug] Azure DevOps UseGitVersion@5 task and GitVersion 5.2.4 produces an error "AssemblyInfoFilename file not found at null" when `UpdateAssemblyInfo: true` is set
Describe the bug
I have recently been updating pipelines to use the UseGitVersion@5 task, replacing the obsolete GitVersion@5 task. For the most part, this has been easy, and I did not encounter any problems until I switched out the task on a pipeline which use GitVersion to update the AssemblyInfo.cs files for a .Net Framework solution. When run, the build fails on the UseGitVersion@5 task, with the error message:
##[error]Error: AssemblyInfoFilename file not found at null
The task is defined in my pipeline as per the example in the GitVersion docs:
- task: UseGitVersion@5
inputs:
versionSpec: '5.x'
updateAssemblyInfo: true
Expected Behavior
The UseGitVersion@5 task should update all AssemblyInfo.cs files under the repository
Actual Behavior
Task execution fails with the error AssemblyInfoFilename file not found at null.
Possible Fix
Unfortunately, I have nothing concrete to offer beyond wild speculation.
Steps to Reproduce
This may be reproduced using the simple pipeline below, in a repo containing a .Net Framework solution with projects that include AssemblyInfo.cs files.
Gitversion.yml file also attached.
See the attached log from pipeline task execution UserGitVersionPipelineTaskLog.log with debugging enabled
Context
No longer able to automate the versioning of assemblies with UseGitVersion@5 as ws possible with GitVersion@5 task.
Your Environment
Azure DevOps Pipelines running on MS hosted Windows Agent
- Version Used:
windows-latestMS hosted agentUseGitVersion@5- v5.1.2- GitVersion 5.2.4
Sample Pipeline
pool:
vmImage: 'windows-latest'
steps:
- task: UseGitVersion@5
inputs:
versionSpec: '5.x'
updateAssemblyInfo: true
Sample GitVersion.yml config used…nothing to see here really
branches: {}
ignore:
sha: []
merge-message-formats: {}
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 2
- Comments: 23 (8 by maintainers)
Commits related to this issue
- GH-2225 use FileSystemGlobbing to resolve AsemblyInfo to be updated — committed to arturcic/GitVersion by arturcic 4 years ago
- GH-2225 use FileSystemGlobbing to resolve AsemblyInfo to be updated — committed to arturcic/GitVersion by arturcic 4 years ago
- GH-2225 use FileSystemGlobbing to resolve AsemblyInfo to be updated — committed to arturcic/GitVersion by arturcic 4 years ago
- GH-2225 use FileSystemGlobbing to resolve AsemblyInfo to be updated — committed to arturcic/GitVersion by arturcic 4 years ago
- GH-2225 use FileSystemGlobbing to resolve AsemblyInfo to be updated — committed to arturcic/GitVersion by arturcic 4 years ago
- GH-2225 use FileSystemGlobbing to resolve AsemblyInfo to be updated — committed to GitTools/GitVersion by arturcic 4 years ago
Sadly, I have multiple
AssemblyInfo.csfiles to update during a build.As would I, but it does not. It was also unnecessary to be explicit about
AssemblyInfo.csfile paths in the obsoleteGitVersion@5task. The simplicity of configuration/inputs in the originalGitVersion@5task was a big driver behind why we adopted it in our organization. TheUseGitVersion@5is even better with seemingly even less to express to get it to “do the right thiing” - I don’t believe it was the intent that the behavior of simply settingupdateAssemblyInfo: truewas meant to break or even change in theUseGitVersion@5task.While I appreciate the sentiments and suggestions expressed above, an
AssemblyInfo.csshared across projects is unfortunately not a viable workaround in my particular situation (impacts too many projects).Also, since a file pattern such as
updateAssemblyInfoFilename: '$(Build.SourcesDirectory)/**/AssemblyInfo.csalso does not work, then there has clearly been a regression as compared to the, now deprecated,GitVersion@5task. TheUseGitVersion@5task appears to be completely incapable of updating multipleAssemblyInfo.csfiles, which does not align with either the documented behavior or, as already mentioned, implicit behavior inGitVersion@5.As an aside, I’ve also noticed a comparatively large performance degradation in
UseGitVersion@5vsGitVersion@5. It seems on averageUseGitVersion@5runs roughly 6-7 times slower at around 30-35 seconds, versusGitVersion@5which runs in roughly 5-6 seconds on the same agent and repository. This is not a deal-breaker by any means, merely an observation for the feedback bucket.We are currently experiencing the same issue. No solution found yet.
I encountered this bug in Version 5.3.x, should I create a new Issue?
@arturcic Was the File Globbing implemented this version? I just tried the UseGitVersion task with 5.3.2, checking
Update AssemblyInfo, and specifying**/AssemblyInfo.cs. I got an error stating that no such file was found.However If I add
/updateassemblyinfo /diagto the command line arguments parameter, it actually works as intended, indicating it updated the files correctly in the diagnostics output.