-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Milestone
Description
Microsoft.Common.CrossTargeting.targets doesn't import these. As a result properties and tasks defined in Directory.build.props, Directory.build.targets are not available in the outer build.
Repro:
- Create a .NET Core Library with project:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp1.0;net46</TargetFrameworks>
</PropertyGroup>
</Project>- Add Directory.Build.targets next to the .csproj file:
<Project>
<Target Name="MyTarget">
<Error Text="Boom!"/>
</Target>
</Project>- Run
> msbuild /t:Restore ClassLibrary.csproj
...
> msbuild /t:MyTarget ClassLibrary.csproj
Project "ClassLibrary.csproj" on node 1 (MyTarget target(s)).
ClassLibrary.csproj : error MSB4057: The target "MyTarget" does not exist in the project.
Done Building Project "ClassLibrary.csproj" (MyTarget target(s)) -- FAILED.
If the project targets a single framework like so:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>
</Project>The target is invoked as expected:
Project "ClassLibrary.csproj" on node 1 (MyTarget target(s)).
Directory.Build.targets(7,5): error : Boom!