diff --git a/dist/azure/gitversion/execute/task.json b/dist/azure/gitversion/execute/task.json
index 22ee7056b..0d25b4120 100644
--- a/dist/azure/gitversion/execute/task.json
+++ b/dist/azure/gitversion/execute/task.json
@@ -108,6 +108,14 @@
"required": false,
"helpMarkDown": "Update versions in specified file",
"visibleRule": "updateAssemblyInfo = true"
+ },
+ {
+ "name": "updateProjectFiles",
+ "type": "boolean",
+ "label": "Update project files",
+ "defaultValue": "false",
+ "required": false,
+ "helpMarkDown": "Whether to update versions in the project files"
}
]
}
diff --git a/docs/examples/azure/gitversion/execute.md b/docs/examples/azure/gitversion/execute.md
index e1276216f..ae22fec07 100644
--- a/docs/examples/azure/gitversion/execute.md
+++ b/docs/examples/azure/gitversion/execute.md
@@ -64,6 +64,10 @@ updateAssemblyInfoFilename:
description: Update versions in specified file
required: false
default: ''
+updateProjectFiles:
+ description: Whether to update versions in all project files
+ required: false
+ default: 'false'
```
## Outputs
@@ -487,3 +491,20 @@ stages:
```
+
+### Example 10
+
+
+ Calculate the version for the build. Update the version in the project files.
+
+```yaml
+steps:
+ # gitversion/setup@3.1.11 task omitted for brevity.
+
+ - task: gitversion/execute@3.1.11
+ displayName: Determine Version
+ inputs:
+ updateProjectFiles: true
+```
+
+
diff --git a/docs/examples/github/gitversion/execute.md b/docs/examples/github/gitversion/execute.md
index abf1b0de5..307a159a9 100644
--- a/docs/examples/github/gitversion/execute.md
+++ b/docs/examples/github/gitversion/execute.md
@@ -66,6 +66,10 @@ updateAssemblyInfoFilename:
description: Update versions in specified file
required: false
default: ''
+updateProjectFiles:
+ description: Whether to update versions in the project files
+ required: false
+ default: 'false'
```
## Outputs
@@ -458,3 +462,20 @@ jobs:
```
+
+### Example 9
+
+
+ Calculate the version for the build. Update the version in the project files.
+
+```yaml
+steps:
+ # gittools/actions/gitversion/setup@v3.1.11 action omitted for brevity.
+
+ - name: Determine Version
+ uses: gittools/actions/gitversion/execute@v3.1.11
+ with:
+ updateProjectFiles: true
+```
+
+
diff --git a/gitversion/execute/action.yml b/gitversion/execute/action.yml
index f8178f752..ed1847d12 100644
--- a/gitversion/execute/action.yml
+++ b/gitversion/execute/action.yml
@@ -47,6 +47,10 @@ inputs:
description: Update versions in specified file
required: false
default: ''
+ updateProjectFiles:
+ description: Whether to update versions in the project files
+ required: false
+ default: 'false'
outputs:
major: # id of output
description: 'The Major value'
diff --git a/src/__tests__/tools/gitversion/settings.spec.ts b/src/__tests__/tools/gitversion/settings.spec.ts
index d45055363..ff729a61d 100644
--- a/src/__tests__/tools/gitversion/settings.spec.ts
+++ b/src/__tests__/tools/gitversion/settings.spec.ts
@@ -14,7 +14,8 @@ describe('GitVersion settings', () => {
configFilePath: 'path',
overrideConfig: ['update-build-number=false'],
updateAssemblyInfo: true,
- updateAssemblyInfoFilename: 'path'
+ updateAssemblyInfoFilename: 'path',
+ updateProjectFiles: true
}
const buildAgent = {
diff --git a/src/__tests__/tools/gitversion/tool.spec.ts b/src/__tests__/tools/gitversion/tool.spec.ts
index 6e31e4543..f783504b0 100644
--- a/src/__tests__/tools/gitversion/tool.spec.ts
+++ b/src/__tests__/tools/gitversion/tool.spec.ts
@@ -251,6 +251,14 @@ describe('GitVersionTool', () => {
} as ExecuteSettings)
expect(args).toEqual(['workdir', '/output', 'json', '/l', 'console', '/config', 'workdir/GitVersion.yml', '/updateassemblyinfo', 'AssemblyInfo.cs'])
})
+
+ it('should return correct arguments for settings with project files', async () => {
+ tool.init(true)
+ const args = await tool.getExecuteArguments('workdir', {
+ updateProjectFiles: true
+ } as ExecuteSettings)
+ expect(args).toEqual(['workdir', '/output', 'json', '/l', 'console', '/updateprojectfiles'])
+ })
})
describe('getCommandArguments', () => {