Here’s the target I defined in Directory.Build.props
file:
<Target Name="BuildAndDeployTools" BeforeTargets="Build" >
<Message Text="Building Tools Solution ..." Importance="high"/>
<MSBuild Projects="$(MSBuildThisFileDirectory)/tools/tools.sln" Properties="Configuration=Release;Platform=Any CPU"/>
<Message Text="Tools Solution is built." Importance="high"/>
</Target>
But when I build my solution I get the following error:
C:Program Filesdotnetsdk8.0.204SdksMicrosoft.NET.SdktargetsMicrosoft.PackageDependencyResolution.targets(266,5): error NETSDK1004: Assets file ‘toolsDiscoveredTestsAsJsonTestLoggerDiscoveredTestsAsJsonTestLogger.Testsobjproject.assets.json’ not found. Run a NuGet package restore to generate this file.
My assumption would be that Build
target is called for the tools solution.
If I explicitly specify Targets="Build"
, I still get the same error.
If I specify Targets="Restore,Compile"
, I get error from .sln.metaproj
file:
toolstools.sln.metaproj : error MSB4057: The target “Compile” does not exist in the project.
If I just run dotnet msbuild .tools.sln /Target:"Restore;Build"
on clean tools
solution it is built without any issue.