Skip to content

Conversation

jjonescz
Copy link
Member

@ghost ghost added Area-Infrastructure untriaged Request triage from a team member labels Aug 30, 2024
@jjonescz jjonescz marked this pull request as ready for review August 30, 2024 14:47
@jjonescz jjonescz requested review from baronfel and jaredpar August 30, 2024 14:48
</data>
<!-- The latest message added is WindowsSDKXamlInvalidTfm. Please update this value with each PR to catch parallel PRs both adding a new message -->
<data name="MicrosoftNetSdkCompilersToolsetRootEmpty" xml:space="preserve">
<value>NETSDK1221: NuGetPackageRoot property is empty so package Microsoft.Net.Sdk.Compilers.Toolset cannot be used but it is recommended because your MSBuild and SDK versions are mismatched. Ensure you are building with '/restore /t:Build' and not '/t:Restore;Build'.</value>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/t:Restore;Build is bad but it's very non-obvious that it is bad. Do we have documentation covering this that we could also refer to from this error message? @baronfel @marcpopMSFT @nkolev92 @zivkan

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a great question. Overall the build check rules are going to start defining a lot of bad msbuild practices. Guessing we will need a bit of a FAQ page to cover them all. I would expect this discussion to be a good fit for that type of page.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://learn.microsoft.com/nuget/reference/msbuild-targets#restoring-and-building-with-one-msbuild-command

although one day we really, really need to split restore and pack into different docs pages, so I don't expect this URL to be long term permanent.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've got a tracking issue for a BuildCheck for this that goes into why it's so subtle and painfully wrong: dotnet/msbuild#9553

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a FAQ style landing page for build check? Basically a page which is here are all the build check warnings that come in the box, their error codes and why we have them?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah - @JanKrivanek showed it in Showcase earlier today but all built-in BuildChecks create a link that links to their docs on this page (though it's all aka.ms links so we can change it to more detailed docs as we require them).

Comment on lines +267 to +268
<NETSdkWarning ResourceName="MicrosoftNetSdkCompilersToolsetRootEmpty"
Condition="'$(_MicrosoftNetSdkCompilersToolsetPackageRootEmpty)' == 'true'" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous error task has a !Exists('$(RoslynTargetsPath)') clause. Should that be mirrored here, or not?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that's necessary, even if $(RoslynTargetsPath) exists and $(NuGetPackageRoot) is empty, that feels like a situation which warrants a warning.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This warning is guarded by $(_NeedsToDownloadMicrosoftNetSdkCompilersToolsetPackage) which means that we are using NuGet here. If we're using NuGet and the $(NuGetPackageRoot) is empty then that seems like a very good case for a warning.

One consideration I made here is that -p:RolynTargetsPath= has been a valid customer scenario for 7+ years now. That still works without warning here even if there is an empty $(NuGetPackageRoot) because it doesn't end up down this code path.

Co-authored-by: Daniel Plaisted <[email protected]>
@baronfel
Copy link
Member

baronfel commented Sep 4, 2024

Merging now that everyone's greened it up. Thanks @jjonescz.

@baronfel baronfel merged commit 05a8250 into dotnet:release/9.0.1xx Sep 4, 2024
31 checks passed
@jjonescz jjonescz deleted the tearing-nuget-warn branch September 4, 2024 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Infrastructure untriaged Request triage from a team member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants