none
Target Framework vs Client .Net Version Installed RRS feed

  • Question

  • I have a Winform project built in VS 2013 targeting .Net 4.5.2.

    The clients machine has .Net 4.7 installed. 

    They seem to be getting various/random app crashes.

    Example:

    Would not having 4.5.2 on the machine be causing this issue?

    UPDATE-
    In Visual Studio my application config file list this:
      <startup useLegacyV2RuntimeActivationPolicy="true">
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
       </startup>

    Does that mean ONLY 4.5.2 is supported?
    If I am not mistaken applications built in VS2013 couldn't target 4.7.

    Note* I have no plans on moving to a newer version of VS just yet. 
    Thursday, January 31, 2019 4:19 PM

All replies

  • You should just need to download the specific version of the Framework, not a new release of Visual Studio.

    https://dotnet.microsoft.com/download/dotnet-framework-runtime


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Thursday, January 31, 2019 5:34 PM
    Moderator
  • Karen,

    This error is occurring on the production server where the application (Release) is run.

    So you are suggesting, removing 4.7 and installing 4.5.2....and I should not update Windows with 4.7?

    Thursday, January 31, 2019 5:37 PM
  • yes, you need to follow steps:

    1) upgrade .net framework with 4.7.* in your dev env.

    2) build your project successfully.


    Sonu Thakur


    • Edited by Sonu T Thursday, January 31, 2019 5:39 PM
    Thursday, January 31, 2019 5:39 PM
  • yes, you need to follow steps:

    1) upgrade .net framework with 4.7.* in your dev env.

    2) build your project successfully.

    Thanks

    Sonu


    Sonu Thakur


    Would I change the Target Framework to 4.7.x? or leave it at 4.5.2 as the minimum?
    Thursday, January 31, 2019 5:41 PM
  • yes, you need to follow steps:

    1) upgrade .net framework with 4.7.* in your dev env.

    2) build your project successfully.

    Thanks

    Sonu


    Sonu Thakur


    So the thought behind this is even though I am targeting 4.5.2, As a developer, in order for my app to run/support a machine with another version of .Net I have to have that SDK installed on my development machine?

    Sorry for "green horn" mentality.  I am relatively new to developing .Net powered applications.
    Thursday, January 31, 2019 5:48 PM
  • yes, you need to follow steps:

    1) upgrade .net framework with 4.7.* in your dev env.

    2) build your project successfully.

    Thanks

    Sonu


    Sonu Thakur


    Would I change the Target Framework to 4.7.x? or leave it at 4.5.2 as the minimum?
    You need to change to the Framework the client has which it sounds like they are using a higher version than you or you have the client install the older Framework, they are your options.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Thursday, January 31, 2019 7:35 PM
    Moderator
  • But I thought the "Target Framework" is the minimum .Net version that is required to run. 
    I have controls that require minimum 4.5.2...So you are suggesting I set my Target to the 4.7x? 

    What if some computers have 4.6 and other 4.7  If I set it at 4.5.2

    How else can a developer support multiple versions of .net?

    I am confused...

    Thursday, January 31, 2019 7:41 PM
  • yes, you need to follow steps:

    1) upgrade .net framework with 4.7.* in your dev env.

    2) build your project successfully.

    Thanks

    Sonu


    Sonu Thakur


    So the thought behind this is even though I am targeting 4.5.2, As a developer, in order for my app to run/support a machine with another version of .Net I have to have that SDK installed on my development machine?

    Sorry for "green horn" mentality.  I am relatively new to developing .Net powered applications.

    No need to be sorry :-)

    What you need is the same Framework version as the customer. For instance, on my current developer box I started with Framework 4.5x then with customer needs installed later versions. You are now not stuck with always using the newer framework, pick and choose.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Thursday, January 31, 2019 8:01 PM
    Moderator
  • I guess I am confused. 

    My application needs a minimum of 4.5.2 because of 3rd party controls.  But Id like to be able to run my app on any PC/server which has 4.5.2 thru 4.7.2

    Or is that not how .Net winform applications are designed?  Are they only designed to be compiled for 1 target version of .Net

    Example.  If I have app that is run on multiple PC's each might have different versions of .Net because maybe IT staff haven't done updates.  As long as the version is greater or equal to 4.5.2 then I would like my application to be able to support it.


    How can I do this?

    Thursday, January 31, 2019 8:16 PM
  • What about this:
    https://stackoverflow.com/questions/4370334/what-does-it-really-mean-to-target-a-framework-and-how-do-i-maximize-compatibil

    In summary, the article/thread states setting the Target Framework in VS to whatever your minimum supported version of .Net is.  Therefore, the application will work at Target and higher (unless your app references newer framework capability).

    So based on that my VS project is setup correctly with 4.5.2 target, but client having 4.7 should still work as expected.


    Thursday, January 31, 2019 8:58 PM
  • What about this:
    https://stackoverflow.com/questions/4370334/what-does-it-really-mean-to-target-a-framework-and-how-do-i-maximize-compatibil

    In summary, the article/thread states setting the Target Framework in VS to whatever your minimum supported version of .Net is.  Therefore, the application will work at Target and higher (unless your app references newer framework capability).

    So based on that my VS project is setup correctly with 4.5.2 target, but client having 4.7 should still work as expected.


    Unless methods in the higher version functionality changes and is not backwards compatible. Seen this happened before.

    Anyways I have nothing else to offer.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Thursday, January 31, 2019 9:53 PM
    Moderator
  • But I thought the "Target Framework" is the minimum .Net version that is required to run. 
    I have controls that require minimum 4.5.2...So you are suggesting I set my Target to the 4.7x? 

    What if some computers have 4.6 and other 4.7  If I set it at 4.5.2

    How else can a developer support multiple versions of .net?

    I am confused...

    You would have to have versions of the code base that worked with a particular version of the .NET Framework.

    A company I worked for had clients that were still using .NET Framework 2.0  a code base version that worked with 2.0, and they would not update to a later version of the  code base and the .NET Framework. Others clients were stayed at Framework 4.0  and the code base that worked on 4.0 etc. and etc., but the clients on a code base and a .NET Framework still need code maintenance.  While other clients always stayed current with the latest code base using the latest .NET Framework.

    That's why you have code repositories, like TFS and others  that have code branching with different versions of the code base using different .NET Frameworks being maintained by a software company that has a specialized software application  the client purchased and had a maintenance agreement.

    So it's not uncommon to have software with a specialized purpose  using various versions of the .NET Framework being maintained. 

    Thursday, January 31, 2019 10:32 PM
  • If my application only references 4.5.2, then how could I determine what/if any part of my code is not compatible with .net 4.6+?

    I would think my code would work on higher versions, unless something I am calling isn't there anymore.  From what I read MS never removes from .Net Framework, they simply add to them.
    Thursday, January 31, 2019 10:45 PM
  • Hi MrAvrProgrammer,

    According to my understandings, .NET Framework 4.7 (or 4.7.x) on target machines (your clients) supports 4.x (4.5, 4.5.1, 4.5.2, etc.). 
    I suppose, in your situation, 3rd party controls are not compatible with 4.7 on target machines. So, I recommend to consult the 3rd party. 

    Regards,

    Ashidacchi -- https://ssl01.rocketnet.jp/hokusosha.com/default.html

    Thursday, January 31, 2019 11:07 PM
  • Hi MrAvrProgrammer,

    According to my understandings, .NET Framework 4.7 (or 4.7.x) on target machines (your clients) supports 4.x (4.5, 4.5.1, 4.5.2, etc.). 
    I suppose, in your situation, 3rd party controls are not compatible with 4.7 on target machines. So, I recommend to consult the 3rd party. 

    Regards,

    Ashidacchi -- https://ssl01.rocketnet.jp/hokusosha.com/default.html


    Well I just tried my 3rd party controls on a Targeted 4.7.2 build and they worked.  I suspect the controls require a 4.5.2 minimum (ill re-confirm this).  Something else must be going on that has nothing to do with my application.  Because it happens at random (so the client says).
    Thursday, January 31, 2019 11:12 PM
  • Well I just tried my 3rd party controls on a Targeted 4.7.2 build and they worked.  I suspect the controls require a 4.5.2 minimum (ill re-confirm this).  Something else must be going on that has nothing to do with my application.  Because it happens at random (so the client says).

    Thank you for more information.
    I understand that your 3rd party controls are compatible with 4.7.2, but your Win.Form application crashes randomly on your client PC...
    What he/she does before crash? Are there any error messages at that time?  I'm afraid you need to specify where (which code line) it happens.

    Regards,

    Ashidacchi -- https://ssl01.rocketnet.jp/hokusosha.com/default.html

    Friday, February 1, 2019 12:09 AM
  • Hi MrAvrProgrammer,

    According to my understandings, .NET Framework 4.7 (or 4.7.x) on target machines (your clients) supports 4.x (4.5, 4.5.1, 4.5.2, etc.). 
    I suppose, in your situation, 3rd party controls are not compatible with 4.7 on target machines. So, I recommend to consult the 3rd party. 

    Regards,


    Ashidacchi -- https://ssl01.rocketnet.jp/hokusosha.com/default.html


    Well I just tried my 3rd party controls on a Targeted 4.7.2 build and they worked.  I suspect the controls require a 4.5.2 minimum (ill re-confirm this).  Something else must be going on that has nothing to do with my application.  Because it happens at random (so the client says).

    I think it's very sad that you have some software you sale to clients that are not using the .NET Framework your code is using and you don't have different code bases for your code that works with different frameworks, clients may be using on their machines. And now you are up against a wall that should never have happened.  

    Friday, February 1, 2019 12:43 AM
  • The software I make and sell has a minimum target framework of 4.5.2.  My 3rd party controls require a minimum of 4.5.2.  They are compatible with 4.5.2 or higher.  Because PC's can have all sorts of framework versions, as long as they have 4.5.2 minimum my software should work as expected.

    I am guessing at the potential problem because my software error handler is not catching any error at the time of the crash and that is where I am left to "guess" at what the potential problem is.  I feel something else is going on the client machine because they ran the software all day today without any issues.

    Personally, I think it has to do with how they installed the software or how they have their Terminal Server configured.  Perhaps some sort of resource sharing...IDK.  There are about 45 different PCs running fine(not using RDS), it is only the Remote Desktop sessions at 1 client that is having this issue. 

    I have another client who uses the exact same software in RDS and they have zero issues. 

    Friday, February 1, 2019 1:35 AM
  • If the application is crashing do you know what it is about is there an exception message? Do you have global exception handling and logging in the solution?
    Friday, February 1, 2019 1:49 AM
  • If the application is crashing do you know what it is about is there an exception message? Do you have global exception handling and logging in the solution?

    Sorry it took me a while to get this.  This is the error my app throws at the exact second the app crashes:
    It states permission denied when writing to my global stack log dumpfile...but how could it be permission denied if this is where I got this log entry from?


    01/31/19 10:15:10 AM - System.Security.SecurityException
    Exception from HRESULT: 0x800A0046 (CTL_E_PERMISSIONDENIED)
       at MYAPP.modStart._Lambda$__135(Object sender, FirstChanceExceptionEventArgs e)
       at Scripting.IFileSystem3.OpenTextFile(String FileName, IOMode IOMode, Boolean Create, Tristate Format)
       at MYAPP.modStart.Write2Stack(String& strText)
       at MYAPP.modStart._Lambda$__135(Object sender, FirstChanceExceptionEventArgs e)
       at Scripting.IFileSystem3.OpenTextFile(String FileName, IOMode IOMode, Boolean Create, Tristate Format)
       at MYAPP.modStart.Write2Stack(String& strText)
       at MYAPP.modStart._Lambda$__135(Object sender, FirstChanceExceptionEventArgs e)
       at Scripting.IFileSystem3.OpenTextFile(String FileName, IOMode IOMode, Boolean Create, Tristate Format)
       at MYAPP.modStart.Write2Stack(String& strText)
       at MYAPP.modStart._Lambda$__135(Object sender, FirstChanceExceptionEventArgs e)
       at Scripting.IFileSystem3.OpenTextFile(String FileName, IOMode IOMode, Boolean Create, Tristate Format)
       at MYAPP.modStart.Write2Stack(String& strText)
       at MYAPP.modStart._Lambda$__135(Object sender, FirstChanceExceptionEventArgs e)
       at Scripting.IFileSystem3.OpenTextFile(String FileName, IOMode IOMode, Boolean Create, Tristate Format)
       at MYAPP.modStart.Write2Stack(String& strText)
       at MYAPP.modStart._Lambda$__135(Object sender, FirstChanceExceptionEventArgs e)
       at Scripting.IFileSystem3.OpenTextFile(String FileName, IOMode IOMode, Boolean Create, Tristate Format)
       at MYAPP.modStart.Write2Stack(String& strText)
       at MYAPP.modStart._Lambda$__135(Object sender, FirstChanceExceptionEventArgs e)
       at Scripting.IFileSystem3.OpenTextFile(String FileName, IOMode IOMode, Boolean Create, Tristate Format)
       at MYAPP.modStart.Write2Stack(String& strText)
       at MYAPP.modStart._Lambda$__135(Object sender, FirstChanceExceptionEventArgs e)
       at Scripting.IFileSystem3.OpenTextFile(String FileName, IOMode IOMode, Boolean Create, Tristate Format)
       at MYAPP.modStart.Write2Stack(String& strText)
       at MYAPP.modStart._Lambda$__135(Object sender, FirstChanceExceptionEventArgs e)
       at Scripting.IFileSystem3.OpenTextFile(String FileName, IOMode IOMode, Boolean Create, Tristate Format)
       at MYAPP.modStart.Write2Stack(String& strText)
       at MYAPP.modStart._Lambda$__135(Object sender, FirstChanceExceptionEventArgs e)
       at Scripting.IFileSystem3.OpenTextFile(String FileName, IOMode IOMode, Boolean Create, Tristate Format)
       at MYAPP.modStart.Write2Stack(String& strText)
       at MYAPP.modStart._Lambda$__135(Object sender, FirstChanceExceptionEventArgs e)
       at Scripting.IFileSystem3.OpenTextFile(String FileName, IOMode IOMode, Boolean Create, Tristate Format)
       at MYAPP.modStart.Write2Stack(String& strText)
       at MYAPP.modStart._Lambda$__135(Object sender, FirstChanceExceptionEventArgs e)
       at Scripting.IFileSystem3.OpenTextFile(String FileName, IOMode IOMode, Boolean Create, Tristate Format)
       at MYAPP.modStart.Write2Stack(String& strText)
       at MYAPP.modStart._Lambda$__135(Object sender, FirstChanceExceptionEventArgs e)
       at Scripting.IFileSystem3.OpenTextFile(String FileName, IOMode IOMode, Boolean Create, Tristate Format)
       at MYAPP.modStart.Write2Stack(String& strText)
       at MYAPP.modStart._Lambda$__135(Object sender, FirstChanceExceptionEventArgs e)
       at Scripting.IFileSystem3.OpenTextFile(String FileName, IOMode IOMode, Boolean Create, Tristate Format)
       at MYAPP.modStart.Write2Stack(String& strText)
       at MYAPP.modStart._Lambda$__135(Object sender, FirstChanceExceptionEventArgs e)
       at Scripting.IFileSystem3.OpenTextFile(String FileName, IOMode IOMode, Boolean Create, Tristate Format)
       at MYAPP.modStart.Write2Stack(String& strText)
       at MYAPP.modStart._Lambda$__135(Object sender, FirstChanceExceptionEventArgs e)
       at Scripting.IFileSystem3.OpenTextFile(String FileName, IOMode IOMode, Boolean Create, Tristate Format)
       at MYAPP.modStart.Write2Stack(String& strText)
       at MYAPP.modStart._Lambda$__135(Object sender, FirstChanceExceptionEventArgs e)
       at Scripting.IFileSystem3.OpenTextFile(String FileName, IOMode IOMode, Boolean Create, Tristate Format)
       at MYAPP.modStart.Write2Stack(String& strText)
       at MYAPP.modStart._Lambda$__135(Object sender, FirstChanceExceptionEventArgs e)
       at Scripting.IFileSystem3.OpenTextFile(String FileName, IOMode IOMode, Boolean Create, Tristate Format)
       at MYAPP.modStart.Write2Stack(String& strText)
       at MYAPP.modStart._Lambda$__135(Object sender, FirstChanceExceptionEventArgs e)
       at Scripting.IFileSystem3.OpenTextFile(String FileName, IOMode IOMode, Boolean Create, Tristate Format)
       at MYAPP.modStart.Write2Stack(String& strText)
       at MYAPP.modStart._Lambda$__135(Object sender, FirstChanceExceptionEventArgs e)
       at Scripting.IFileSystem3.OpenTextFile(String FileName, IOMode IOMode, Boolean Create, Tristate Format)
       at MYAPP.modStart.Write2Stack(String& strText)
       at MYAPP.modStart._Lambda$__135(Object sender, FirstChanceExceptionEventArgs e)
       at System.Windows.Forms.WindowsFormsSynchronizationContext.Send(SendOrPostCallback d, Object state)
       at Microsoft.Win32.SystemEvents.SystemEventInvokeInfo.Invoke(Boolean checkFinalization, Object[] args)
       at Microsoft.Win32.SystemEvents.RaiseEvent(Boolean checkFinalization, Object key, Object[] args)
       at Microsoft.Win32.SystemEvents.OnUserPreferenceChanging(Int32 msg, IntPtr wParam, IntPtr lParam)
       at Microsoft.Win32.SystemEvents.WindowProc(IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
       at MYAPP.My.MyApplication.Main(String[] Args)
    Friday, February 1, 2019 2:46 PM
  • It states permission denied when writing to my global stack log dumpfile...but how could it be permission denied if this is where I got this log entry from?

    I was looking more for an exception message and stack trace. 

    Maybe, you should what is in the link. There is a VB.NET example code in the download. The code catches all unhandled exceptions, which means you don't need any try/catch in the code, which you should be able to implement in your project.

    https://www.codeproject.com/Articles/43182/Centralised-Exception-Handling-in-C-Windows-Applic

    You can use Log4NET to log the exception, the stack trace and the inner.exception'message that is part of the stack trace.

    https://pisquare.osisoft.com/community/developers-club/blog/2016/05/10/adding-logging-to-a-net-application-using-log4net

    Friday, February 1, 2019 4:48 PM
  • Specifying 4.52 as the sku simply means that this version or higher is required.  There is no need for that exact version to be installed.

    There is also no need to move your target up if your client only has a newer version installed.

    The problem you are having has nothing to do with your config file.  Are you including the config file with your install?


    Convert between VB, C#, C++, & Java (http://www.tangiblesoftwaresolutions.com)
    Instant C# - VB to C# Converter
    Instant VB - C# to VB Converter


    Friday, February 1, 2019 4:49 PM