question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Project file generated by dotnet tool restore should avoid importing Directory.Build.props and Directory.Build.targets

See original GitHub issue

The temporary project that dotnet tool restore generates emits a bunch of flags that clears out some SDK default behavior: https://github.com/dotnet/toolset/blob/master/src/dotnet/ToolPackage/ToolPackageInstaller.cs#L189-L196. In addition to this, it should also avoid importing Directory.Build.props and targets.

<ImportDirectoryBuildProps>false</ImportDirectoryBuildProps>
<ImportDirectoryBuildTargets>false</ImportDirectoryBuildTargets>

This would mirror the behavior of deps file generation: https://github.com/dotnet/sdk/blob/master/src/Tasks/Microsoft.NET.Build.Tasks/targets/GenerateDeps/GenerateDeps.proj#L25-L28

Background:

ASP.NET Core has a Directory.Build.props \ targets at the root of the repo. We recently retarted the TempDir to point to a sub dir of the root. This caused dotnet tool restore’s temporary project file to pick up these props and targets resulting in build failures.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:2
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
nguerreracommented, Feb 1, 2020

Totally reasonable.

0reactions
KalleOlaviNiemitalocommented, Oct 23, 2022

Is Directory.Build.rsp likewise used? If so, should it be suppressed?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Customize your build - MSBuild
In this article. Explore customization options; Add arguments to command-line MSBuild invocations for your project; See also.
Read more >
msbuild - Why doesn't Directory.Build.props work when ...
When I build the solution using MSBuild, I am able to generate the XML files properly. However, using a Build -> Rebuild Solution...
Read more >
How does `msbuild` know where to find the `Directory.Build ...
NET project, I noticed that msbuild will use definitions from a file called Directory.build.props several folders above my current working ...
Read more >
Tips & Tricks to improve your .NET Build Setup with MSBuild
We will also have a look at how to diagnose issues and what tools to go to when ... Build. props / targets...
Read more >
Snyk for .NET
First, restore dependencies in the .NET project by running dotnet restore and make sure that obj/project.assets.json has been created by the previous ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found