Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cezarypiatek/msbuild-cheatsheet
https://github.com/cezarypiatek/msbuild-cheatsheet
Last synced: 4 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/cezarypiatek/msbuild-cheatsheet
- Owner: cezarypiatek
- Created: 2019-11-03T18:24:45.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2019-11-14T20:38:19.000Z (almost 5 years ago)
- Last Synced: 2024-08-01T16:45:12.654Z (3 months ago)
- Size: 11.7 KB
- Stars: 33
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MsBuild cheatsheet
## Properties
### Define property
```xml
Value
```
## Collections
### Define collection
```xml
ValueX
ValueY
```
[MSBuild well-known item metadata](https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-well-known-item-metadata?view=vs-2019)### Update metadata
```xml
ValueZ
```
### Remove elements
```xml
```
### Remove duplicates
```xml
fr
```
### Write elements to file
```xml
```
### Read elements from file
```xml
```
## Conditions
### Conditional Groups
```xml
$(MSBuildFrameworkToolsPath)\Microsoft.CSharp.targets
$(MsBuildFrameworkToolsPath)
$(MSBuildToolsPath)\Microsoft.CSharp.CrossTargeting.targets
$(MSBuildToolsPath)\Microsoft.CSharp.CurrentVersion.targets
```
## Targets
### Import file with targets
```xml
```
### Call another target
```xml
```### Incremental build
The target will be skipped if the output file exists is newer than all of the input files.
```xml
```
### Run target for each element
```xml
```
### Running target if file get changed
This will run `GenerateCodeFromAttributes` target if any files that belongs to `Compile` collection get changed.```xml
MSBuild:GenerateCodeFromAttributes
```
## Tasks
### Using task
```xml
```### Inline task with C#
https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-inline-tasks?view=vs-2019
```xml
```### Inline task with PowerShell
https://blogs.msdn.microsoft.com/msbuild/2010/02/20/msbuild-task-factories-guest-starring-windows-powershell/
```xml
[email protected]
[email protected];[email protected]
```
## Path's tasks
Convert path to absolute path
```xml
```
## Additional *.props and *.targets files loaded by convention
https://docs.microsoft.com/en-us/visualstudio/msbuild/customize-your-build?view=vs-2019