-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
Description
Setup
At the root of my repo I have a Directory.Build.props containing:
<Project>
<PropertyGroup>
<CustomMessage>Hello!</CustomMessage>
</PropertyGroup>
</Project>I also have a Directory.Build.targets containing:
<Project>
<Target Name="SimpleMessage" BeforeTargets="Build">
<Message Text="My Message is => $(CustomMessage)" Importance="high" />
</Target>
</Project>Issue
When the target is invoked directly, using dotnet build /t:SimpleMessage or dotnet msbuild /t:SimpleMessage the target cannot be found
C:\Code\Example\src\Example\bin\Debug\net462\Example.csproj : error MSB4057: The target "SimpleMessage" does not exist in the project.
Expected
I would expect the target to be discovered and invoked.
Aside
When invoking dotnet build the SimpleMessage target is fired before a build:
My Message is => Hello!
Example -> C:\Code\Example\src\Example\bin\Debug\net462\Example.dll
If I move the target from the *.targets file to the *.props file, the direct invocation works.
After running dotnet msbuild .\src\Example\Example.csproj /pp:out.xml I can see in the out.xml that Directory.Build.props was imported but Directory.Build.targets was not
Repro is now attached
repro.zip