dotnet / dotnet/msbuild

Well-known metadata not available when dynamically creating items

Open
#2,844 3 comments 2 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

Well-known item metadata is not available during item creation for dynamically defined items (items defined within a Target). I am not super familiar with msbuild but this was surprising to me.

### Steps to reproduce

Project file
```xml











```

Directory contents:
```
/
- repro.proj
- myfiles/
- file1
- file2
- file3
```

Command line
```
msbuild repro.proj /t:MyTarget
```
### Expected behavior
Prints:
```
myfiles\file1 -> file1
myfiles\file2 -> file2
myfiles\file3 -> file3
myfiles\file1 -> file1
myfiles\file2 -> file2
myfiles\file3 -> file3
myfiles\file1 -> file1
myfiles\file2 -> file2
myfiles\file3 -> file3
```

### Actual behavior
Prints:
```
myfiles\file1 -> file1
myfiles\file2 -> file2
myfiles\file3 -> file3
myfiles\file1 ->
myfiles\file2 ->
myfiles\file3 ->
myfiles\file1 -> file1
myfiles\file2 -> file2
myfiles\file3 -> file3
```

### Environment data
`msbuild /version` output:

```
Microsoft (R) Build Engine version 15.4.8.50001 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

15.4.8.50001
```

OS info:
`Microsoft Windows [Version 10.0.16299.192]`

If applicable, version of the tool that invokes MSBuild (Visual Studio, dotnet CLI, etc):

I'm seeing this behavior everywhere - VS, dotnet, running msbuild manually.

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.