-
Edit: While I've marked an answer it is worth taking a look at the whole thread because both responses offer great information. Hi all, Apologies if this is the wrong forum to ask this question. If there is any guidance on who is best to answer this question it would be much appreciated if you shout it out. We have coupled our CI/CD pipeline and release machines to the same Windows Server version. The belief is that if you build code on Windows Server 2022 then deploying it on Windows Server 2019 might fail in unique circumstances because you didn't build or run tests on the same operating system version. As you can imagine this becomes a pain anytime we need to upgrade CI/CD machines to support technologies outside of the .NET ecosystem because we use the same machines for different technology stacks. My question is does the operating system impact the build output of the compilation? I'm struggling to see how at the moment. I can see how the operating system might limit which SDKs you can install but would have expected that the SDK is the one that dictates the build output. In other words I'd expect a Windows Server 2022 machine with SDK 7.0.3 build output to be equivalent to Windows Server 2019 with SDK 7.0.3. If it matters this is all .NET Framework 4.8, .NET Standard 2.0, .NET Standard 2.1, .NET 6, and .NET 7 target framework code. Thanks for reading! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
If you're using deterministic mode of the compiler (which should be on by default in SDK-style projects, I think), then all the things that affect the output of the compiler are described here. Based on that, I think a different OS version shouldn't have a noticeable effect on the produced assembly. Though you mentioned you don't want to test on different OSes, and the compiler can't help you there: if your code uses any OS-specific functionality, its behavior will of course be different on different OSes. |
Beta Was this translation helpful? Give feedback.
If you're using deterministic mode of the compiler (which should be on by default in SDK-style projects, I think), then all the things that affect the output of the compiler are described here.
Based on that, I think a different OS version shouldn't have a noticeable effect on the produced assembly.
Though you mentioned you don't want to test on different OSes, and the compiler can't help you there: if your code uses any OS-specific functionality, its behavior will of course be different on different OSes.