I have installed VS 2017 and started building my solution with MSBuild 15. Immediately I notice that none of my before.{SolutionName}.sln.targets
files are loaded.
I checked with ProcMon and the files are open and read without errors. But none of their actions are run.
Has anyone faced this situation? Any help is welcome.
EDIT 1
Here is my file:
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Restore">
<Target Name="Restore" BeforeTargets="Build;Rebuild">
<MSBuild Projects=".nuget\NuGet.Targets" Targets="RestoreSolutionPackages" Properties="SolutionFile=..\$(MSBuildProjectName);NuGetVerbosity=$(NuGetVerbosity)"/>
</Target>
</Project>
It is working in VS 2015, but stopped working in VS 2017.
I figured out what is the problem. VS 2017 introduced a new target into the generated sln.metaproj file - Restore
and this target overshadowed my own target in the before.{SolutionFile}.sln.targets
file.
Once I renamed the target to MyRestore
it worked again.
Wasted 3 hours on it :-(.