ltrzesniewski / InlineIL.Fody

Inject arbitrary IL code at compile time.
MIT License
240 stars 17 forks source link

Can this actually be built for Net 4.5? #8

Closed michel-pi closed 5 years ago

michel-pi commented 5 years ago

Hey!

I just wanted to ask if it is possible to built this library for .Net 4.5? What is the reason for the use of 4.52?

It's fine if you do not plan to provide a 4.5 build. I am just curious and would like to target against 4.5

I really like this project. Good job!

ltrzesniewski commented 5 years ago

Hi, and thanks! 😄

The InlineIL library targets .NET 4.5.2 simply because it follows the Fody recommendation to target the oldest .NET Framework version which is still supported by Microsoft.

Nothing really prevents targeting a lower version, but you should be aware that you're using a framework which does not receive any bugfixes nor security updates (support ended over 3 years ago). Therefore I'd advise you to update your project to target .NET 4.5.2 or higher.

Also, note that the weaver part targets .NET 4.6 and .NET Standard 2.0, since that's what MSBuild 15 targets (the one that ships with VS 2017), so you'll still need VS 2017 to compile a project that uses Fody v4 (Fody v5 will require VS 2019).

So if you use VS 2017 or 2019 and don't want to upgrade your project I guess I could lower the target to .NET 4.5, but as you can see it's a bad idea and there's really no reason not to upgrade to a supported framework.

michel-pi commented 5 years ago

I see why you should not use it in an app you release. You can run 4.5 under 4.7 framework and within a 4.7 app so i guess thats fine.

I usually go with .Net 4.5 if i need none of the new features when building a library.

I wouldn't be upset if you want to go with 4.52. It's fine too.

ltrzesniewski commented 5 years ago

I see. If you really need me to add support for net45 I can do that but be aware that this could go away soon (I'm not sure the VS 2019 install on Azure Pipelines even supports it, and I'll switch to this image soon).

If you're building a new library, consider targeting netstandard2.0 only - it's the recommended target to reach the most users, and I don't think supporting very old stuff in new code is worthwhile. If you already have an existing library, you still can target newer frameworks - your existing users don't necessarily have to update to the newest version.

So, do you want me to release a .NET 4.5 version, knowing that a later release will probably remove this support?

michel-pi commented 5 years ago

not needed. then keep this 😃

ltrzesniewski commented 5 years ago

ok 😉