janisito
Posts: 75
Joined: Thu Apr 09, 2015 6:28 am

.NET Framework run time version used by custom action

Fri Jul 30, 2021 9:39 am

Hi!

When I use a C# custom action written by myself, under which .NET Framework run time version will the custom action be executed? Is this decided by AdvancedInstaller or can I choose it myself by modifying the CustomAction.config file? I want the custom action to be run under v4.8.

Thanks.

Regards
Jan

Catalin
Posts: 4355
Joined: Wed Jun 13, 2018 7:49 am

Re: .NET Framework run time version used by custom action

Fri Jul 30, 2021 1:12 pm

Hello Jan,

I believe the custom action will use the runtime you specified in your Visual Studio project's properties.

If you right click on your project in Visual Studio --> "Properties" --> "Application", it should specify the targeted framework, i.e.:
runtime.png
runtime.png (50.6 KiB) Viewed 4701 times

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

janisito
Posts: 75
Joined: Thu Apr 09, 2015 6:28 am

Re: .NET Framework run time version used by custom action

Mon Aug 02, 2021 3:29 pm

Hi Catalin,

I tried to verify the runtime version by logging the following property to the log file:

Code: Select all

AppDomain.CurrentDomain.SetupInformation.TargetFrameworkName
but it returns an empty string when run from the custom action. Normally when run from a console application it returns what .NET Framework version it is using. Not sure why that is or if there another way to verify the actual runtime version used. I have indeed set my custom action project to use .NET Framework v4.8 but I'm not sure it is enough.

Regards
Jan

Catalin
Posts: 4355
Joined: Wed Jun 13, 2018 7:49 am

Re: .NET Framework run time version used by custom action

Thu Aug 05, 2021 8:10 am

Hello Jan,

If you have specified the target framework in your custom action, I do not see why it would use another version, as long as the targeted version is installed on the machine.

In the following Microsoft article:

Framework targeting overview

it is specified that:
In Visual Studio, you can specify the version of .NET that you want your project to target. Framework targeting helps guarantee that the application uses only functionality that is available in the specified framework version. For .NET Framework apps to run on another computer, the framework version that the application targets must be compatible with the framework version that's installed on the computer.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

janisito
Posts: 75
Joined: Thu Apr 09, 2015 6:28 am

Re: .NET Framework run time version used by custom action

Thu Aug 05, 2021 2:09 pm

Hi Catalin,

That makes sense. Thank you for resolving.

Regards
Jan

Catalin
Posts: 4355
Joined: Wed Jun 13, 2018 7:49 am

Re: .NET Framework run time version used by custom action

Thu Aug 05, 2021 6:51 pm

You are always welcome, Jan!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”