I'm importing a props file from a nuget using PackageReference. Working with this using commandline is not an issue since msbuild /t:restore
can parse the project files and it ignores missing files. msbuild /t:build
then has valid paths to work with courtesy of restore.
Visual Studio however fails to load any project containing such import since it determines that to be an invalid csproj. How can I make Visual Studio ignore this import for loading?
Note that if I were to use msbuild /t:restore
first from commandline(so that XXX.csproj.nuget.g.props
and XXX.csproj.nuget.g.targets
are generated), Visual Studio can load the project fine. I want to avoid such a dependency.
Import snippet:
<ItemGroup>
<PackageReference Include="ScopedManifest.Task" GeneratePathProperty="true" />
</ItemGroup>
<Import Project="$(Pkg_ScopedManifest_Task)\include\ScopedManifestTask.Props" />
Error when loading project in VS:
error : The imported project "D:\include\ScopedManifestTask.Props" was not found. Confirm that the expression in the Import declaration "\include\ScopedManifestTask.Props" is correct, and that the file exists on disk. D:\work\test-build\repo\src\Manifest\Manifest.csproj