Skip to content

Disable Microsoft.IO.Redist on non-Windows Fixes #7335#7460

Merged
rainersigwald merged 1 commit intodotnet:mainfrom
Forgind:redist-on-mac
Mar 24, 2022
Merged

Disable Microsoft.IO.Redist on non-Windows Fixes #7335#7460
rainersigwald merged 1 commit intodotnet:mainfrom
Forgind:redist-on-mac

Conversation

@Forgind
Copy link
Copy Markdown
Contributor

@Forgind Forgind commented Mar 10, 2022

Fixes #7335

Context

Microsoft.IO.Redist requires using a windows library, so it doesn't work on linux/mac. Users using framework on either of those platforms get exceptions.

Changes Made

Disable MS.IO.Redist on non-windows

Testing

None

@Forgind
Copy link
Copy Markdown
Contributor Author

Forgind commented Mar 11, 2022

I'm confused as to why this is failing. From the errors, it looks like, with this change, Microsoft.IO.Redist is turned on for linux/mac, but it should make it more restrictive, not less.

Possible things I can think of that at least might fix something:
Add parentheses
Add one of: == 'true', != 'false', or == 'false'
Replace this preprocessor directive with something (static, presumably) that actually checks the OS, but I'm not sure (how) that would work.

Any thoughts?

@rainersigwald
Copy link
Copy Markdown
Member

This PR changes the behavior of the output MSBuild assemblies based on the OS of the machine that builds them. That's not what we want; we want to change the runtime behavior of the same output MSBuild assemblies based on the runtime environment, so that the .NET Framework MSBuild avoids the Microsoft.IO.Redist codepaths when running on Mono.

@Forgind
Copy link
Copy Markdown
Contributor Author

Forgind commented Mar 11, 2022

I guess what I'm confused by is how to make a runtime check work cleanly. Say we had:

#if MSIOREDIST
code1
#else
code2
#endif

You could convert that to:

#if MSIOREDIST
if (mono)
code2
else
call function
#else
code2
#endif

function {
code1
}

but that feels really messy, and I'm not sure how to make that work with the property—just ignore it?

Also, I'm still confused as to why this PR would fail rather than just not doing the right thing. Any thoughts on that?

@Forgind Forgind added the merge-when-branch-open PRs that are approved, except that there is a problem that means we are not merging stuff right now. label Mar 14, 2022
@rainersigwald rainersigwald merged commit b66039c into dotnet:main Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-when-branch-open PRs that are approved, except that there is a problem that means we are not merging stuff right now.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a runtime check for Microsoft.IO.Redist

2 participants