dotnet / dotnet/msbuild

Question : How to pass msbuild properties to child msbuild tasks cleanly ?

Open
#3,363 1 comment 0 reactions 0 assignees View on GitHub
triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 13h
Merged PRs (30d)
133

Description

I have not added repro steps as this is more of a question than a bug. Please let me know if i still need to add a sample project.

I have 10 properties that i set with command line arguments for msbuild.
I have few `` task in my csproj where i need to forward these properties.

If i have to add another property `MyProperty11`, i have to go modify all these `MSBuild` task to correctly forward the properties.

Is there a simpler & cleaner way to forward properties ?
How can i capture all the properties passed to parent msbuild task and forward to children msbuild tasks.

Command line
```
dotnet msbuild /p:MyProperty1=MyValue1 /p:MyProperty2=MyValue2 ...
```

```
asnegi@asnegi-vm $ dotnet msbuild /version
Microsoft (R) Build Engine version 15.4.8.50001 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

15.4.8.50001
```

OS info:

Both windows and Linux.

If applicable, version of the tool that invokes MSBuild (Visual Studio, dotnet CLI, etc):
```
$ dotnet --info
.NET Command Line Tools (2.0.3)

Product Information:
Version: 2.0.3
Commit SHA-1 hash: eb1d5ee318

Runtime Environment:
OS Name: ubuntu
OS Version: 16.04
OS Platform: Linux
RID: ubuntu.16.04-x64
Base Path: /usr/share/dotnet/sdk/2.0.3/

Microsoft .NET Core Shared Framework Host

Version : 2.0.7
Build : 2d61d0b043915bc948ebf98836fefe9ba942be11
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.