-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fix error message for non-Windows OS #12046
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@@ -248,7 +249,7 @@ private IList<String> GetPaths(string rootPath, string targetFrameworkFallbackSe | |||
{ | |||
// No reference assembly paths could be found, log an error so an invalid build will not be produced. | |||
// 1/26/16: Note this was changed from a warning to an error (see GitHub #173). | |||
if (pathsToReturn.Count == 0) | |||
if (pathsToReturn.Count == 0 && RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (pathsToReturn.Count == 0 && RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) | |
if (pathsToReturn.Count == 0 && NativeMethodsShared.IsWindows) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, I wasn't sure if I should use RuntimeInformation and that's definitely look better
c0de58b
to
e1af409
Compare
@@ -248,7 +248,7 @@ private IList<String> GetPaths(string rootPath, string targetFrameworkFallbackSe | |||
{ | |||
// No reference assembly paths could be found, log an error so an invalid build will not be produced. | |||
// 1/26/16: Note this was changed from a warning to an error (see GitHub #173). | |||
if (pathsToReturn.Count == 0) | |||
if (pathsToReturn.Count == 0 && NativeMethodsShared.IsWindows) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd still like to return an error in the non-Windows case. It just shouldn't reference installing Windows-only targeting packs.
@@ -248,7 +248,7 @@ private IList<String> GetPaths(string rootPath, string targetFrameworkFallbackSe | |||
{ | |||
// No reference assembly paths could be found, log an error so an invalid build will not be produced. | |||
// 1/26/16: Note this was changed from a warning to an error (see GitHub #173). | |||
if (pathsToReturn.Count == 0) | |||
if (pathsToReturn.Count == 0 && NativeMethodsShared.IsWindows) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the right condition here IsWindows
, or #if NET
? Does the find-targeting-packs code work on Windows/net9?
Fixes #6647
Context
We shouldn't show error about Developer Pack on non-Windows OSes. This message is reasonable for Windows scenarios, but since there are no .NET Framework Developer or Targeting Packs for Linux or macOS, we shouldn't mention them in that circumstance.
Error message:
error MSB3644: The reference assemblies for .NETFramework,Version=v4.8 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks
Changes Made
Check added to determine if the OS is Windows
Testing
Tests passed
Notes
I assumed we also shouldn't show GetReferenceAssemblyPaths.OutOfDateSDK error if it's not Windows but I can change that if its not true