microsoft / dotnet

This repo is the official home of .NET on GitHub. It's a great starting point to find many .NET OSS projects from Microsoft and the community, including many that are part of the .NET Foundation.
https://devblogs.microsoft.com/dotnet/
MIT License
14.43k stars 2.22k forks source link

.NET 4.8.1 on M2 and Windows 11 ARM #1369

Open jcolebrand opened 1 year ago

jcolebrand commented 1 year ago

:waves: long time caller, first time listener

In RE: https://devblogs.microsoft.com/dotnet/announcing-dotnet-framework-481/#supported-windows-versions (which points to this place for feedback/comments) I have a couple questions that I did not easily find answered in the search bar here, and thought it would be nice to have a system of record somewhere for other searchers too.

I am super happy to be redirected to existing resources here that show that I can not search, I can take the :shame: if required :D

I'm curious if I follow the information in that post above, and can I run Windows 11 ARM on an Apple M2 MAX with VS Pro ARM edition, since this conversation https://github.com/dotnet/aspnetcore/issues/42699#issuecomment-1192885272 indicates that I could in fact run IIS on ARM 64 with net 7 and 4.8.1 being announced in the first link above and run my legacy code that's in 4.8

It can be confusing to find information on the internet due to all the monetized blogs that spam google/bing results, and sometimes the folks here on github have a lot more direct information, as being developer-focused, instead of consumer-focused.

Let's try and arrange it this way:

  1. Windows 11 ARM runs IIS
  2. The above IIS can run net7 + net 4.8.1 as-per-typical on other platforms, with minimal changes to my existing processes (probably)
  3. net7 code can run things that were built on net6, even tho net6 is not natively running on ARM (link above)
  4. 4.8.1 is backwards compatible to run 4.8 framework code on ARM64 CPUs (without being forced to recompile things locally, this has been the standard Framework practice for a while now)
  5. PowerShell 7 runs fine on ARM64, so aside from PS5 specific semantics that need to be resolved, my existing module suite (around 1000 cmdlets that build into about a dozen modules, so only a few changes, I'm sure :D )
  6. I can't run win64-/win32- only code on ARM in all cases (some may somehow magically work, but I should not expect them to)
  7. Most mainstream developer apps that I should expect to work on ARM64 have typically already made their way over (eg: git) and of course the above limitation about win64/32 definitely applies here
  8. For the record, and in completion, I run Parallels and I know they have a version for ARM already as well

Really, on the above, 3. and 4. are the ones I want to confirm I understand correctly, because if I can run previously compiled code on the newer runtimes (knowing that net 7 is not LTS, but is a good way-point to net8) without recompiling, then I should be able to move from my 4 year old Intel (32GB) over and continue to use most of my existing workflows, yes?

lextm commented 1 year ago

What you posted is confusing.

IIS/Windows 11 ARM64 is a lot more complicated than I initially thought, so I just share a few tips I learned recently,

  1. You do need the proper hardware to run Windows 11 ARM64. Apple M2 devices should work (though I am still on M1). You can choose from several virtualization tools, more than Parallels, and I am using VMware Fusion right now. The disk file conversion and installation steps can be learned from other posts (search engines should lead you there).
  2. IIS core features (including .NET Framework 4.8.x) should just work. .NET Framework 3.5.x, however, doesn't but that's kind of expected.
  3. No IIS OOB components (like URL Rewrite) works yet with ARM64 application pools. They work for x64 and x86 pools.
  4. .NET 6 works in x64/x86 modes on IIS. No ARM64 mode (matching the GitHub thread you referred to).
  5. .NET 7 works in pure ARM64 mode on IIS due to its packaging issues. But not in x64 or x86. It is possible to get x64/x86 working with hacks, but you'd better wait for my work to be done. You can read https://github.com/dotnet/aspnetcore/issues/47115 for more details.

I don't want to comment on general .NET apps not on IIS right now, as I am still learning that.

Overall, it is still a platform in preview, so things might change rapidly. A lot of things about it can come from various channels, not only Microsoft, and I think that's actually good.

Apollo9999 commented 1 year ago

IIS/Windows 11 ARM64. It is a complex topic, but it's important for anyone who is developing or deploying web applications on ARM64 devices.

Here are a few tips that I have learned:

Make sure that you are using the latest version of IIS. IIS 10.0 and earlier do not support ARM64. When installing IIS, be sure to select the ASP.NET Core module. This is required for hosting ASP.NET Core web applications on IIS ARM64. If you are hosting ASP.NET Framework web applications on IIS ARM64, you must use the .NET Framework 4.8.x runtime. Earlier versions of the .NET Framework are not supported on ARM64. When creating an application pool for an ASP.NET Framework web application, be sure to select the ARM64 application pool type. If you are using the URL Rewrite module, make sure that you are using the ARM64 version. The x64 version of the URL Rewrite module will not work on IIS ARM64. Here are a few additional tips that you may find helpful:

If you are having trouble running a web application on IIS ARM64, check the event viewer for errors. IIS will log any errors that occur when starting or running web applications. If you are still having trouble, try searching for help online or contacting Microsoft support.

lextm commented 1 year ago

@Apollo9999 several issues can be found in your comments,

  1. "Make sure that you are using the latest version of IIS. IIS 10.0 and earlier do not support ARM64" is incorrect. You'd better be very specific today as Windows 11 ARM64 as this is the only feasible Windows release today with ARM64 support. There isn't any other Windows release (like Windows Server) yet (Windows 10 ARM64 is too old to fall in the category).
  2. "Earlier versions of the .NET Framework are not supported on ARM64" is also ambigious. .NET Framework 4.0-4.7.2 apps should work flawlessly in most cases, while .NET Framework 1.0-3.5.1 apps don't (and need migration).
  3. "be sure to select the ARM64 application pool type" is incorrect. I already explained above that x64 and x86 application pools are also feasible.
  4. "If you are using the URL Rewrite module, make sure that you are using the ARM64 version" is incorrect. There isn't an ARM64 build of IIS URL Rewrite module as far as I know. You might show us where that build is since you claimed it.

Think twice if you use AI generated contents in your posts (two of your recent ones on GitHub are likely), as AI doesn't really understand the concepts and can be wrong.

HybridSolutions commented 5 months ago

Don't know if anyone can help but this topic seemed the best place to try and ask.

  1. At this time, is a machine with the latest snapdragon and running windows 11 for ARM64 capable of running IIS and Web applications that target .net framework 4.8?
  2. Is this also possible on latest MACs running any kind of virtualization software like Parallels?

Thank you!

lextm commented 5 months ago

@HybridSolutions

  1. At this time, is a machine with the latest snapdragon and running windows 11 for ARM64 capable of running IIS and Web applications that target .net framework 4.8?

Yes

  1. Is this also possible on latest MACs running any kind of virtualization software like Parallels?

Mac related questions like this should go to Apple support, or the specific virtualization software vendors, because "possible", "latest", and "any kind" in this question makes it not feasible to be answered by anyone here.

joeyguerra commented 2 months ago

MSMQ on M1 with Parallels won't activate.