I have foo.csproj,
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup Label="Globals">
<ExtPath>$(SolutionDir)\WpfNetStandardSample\CustomProjectSystem\</ExtPath>
</PropertyGroup>
<Import Project="$(ExtPath)CustomProject.props" />
</Project>
referenced from solution file bar.sln.
To restore my NuGet packages from the continuous integration server, I run
msbuild /t:restore bar.sln
And I get the error:
"C:\Users\phelan\workspace\bar\bar.sln" (restore target) (1) -> "C:\Users\phelan\workspace\bar\foo\foo.csproj" (_IsProjectRestoreSupported target) (11) -> C:\Users\phelan\workspace\bar\foo\foo.csproj(7,3): error MSB4019: The imported project "C:\WpfNetStandardSample\CustomProjectSystem\CustomProject.props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
Main Question
How and why is SolutionDir resolving to C:\ and not the directory the solution file is in?
Notes
- The entire solution builds from within Visual Studio.
- Running
msbuild foo.sln
builds the entire solution (assuming NuGet packages are already restored) - MSBuild version is 15.3.409.57025
- The solution is a mixture of projects, some using packages.config and some using PackageReference. Some of the projects using PackageReference are dotnetstandard libraries and some are net461 libraries.
- There seems to be a variety of suggestion on how to restore NuGet packages
What is the correct process for my type of mixed setup?