C# 我在Windows 10上用VS2017编译了一个安装项目。它能在XP上运行吗?

C# 我在Windows 10上用VS2017编译了一个安装项目。它能在XP上运行吗?,c#,installation,visual-studio-2017,windows-xp,visual-studio-setup-proje,C#,Installation,Visual Studio 2017,Windows Xp,Visual Studio Setup Proje,我已经使用Visual Studio 2017创建了一个安装项目,并在Windows 10上进行了编译。它是用C#WPF编写的,目标框架是.netframework4。目标平台是任何CPU 现在我已经编译了安装项目,我正在尝试在WindowsXP上运行MSI。MSI已成功运行并安装程序,但该程序不会打开。我看到一个错误消息框,上面写着: MyProgram遇到问题,需要关闭。给您带来的不便,我们深表歉意。 根据计算机事件,出现NotSupportedException错误: Applicatio

我已经使用Visual Studio 2017创建了一个安装项目,并在Windows 10上进行了编译。它是用C#WPF编写的,目标框架是
.netframework4
。目标平台是
任何CPU

现在我已经编译了安装项目,我正在尝试在WindowsXP上运行MSI。MSI已成功运行并安装程序,但该程序不会打开。我看到一个错误消息框,上面写着:

MyProgram遇到问题,需要关闭。给您带来的不便,我们深表歉意。

根据计算机事件,出现
NotSupportedException
错误:

Application: MyProgram.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.NotSupportedException
Stack:
   at System.Net.ServicePointManager.set_SecurityProtocol(System.Net.SecurityProtocolType)
   at MyProgram.App.OnStartup(System.Windows.StartupEventArgs)
   at System.Windows.Application.<.ctor>b__1(System.Object)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(System.Object)
   at System.Threading.ExecutionContext.runTryCode(System.Object)
   at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode, CleanupCode, System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   at System.Windows.Threading.Dispatcher.InvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
   at System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame)
   at System.Windows.Application.RunDispatcher(System.Object)
   at System.Windows.Application.RunInternal(System.Windows.Window)
   at System.Windows.Application.Run(System.Windows.Window)
   at MyProgram.App.Main()
应用程序:MyProgram.exe
框架版本:v4.0.30319
描述:由于未处理的异常,进程已终止。
异常信息:System.NotSupportedException
堆栈:
位于System.Net.ServicePointManager.set_SecurityProtocol(System.Net.SecurityProtocolType)
在MyProgram.App.OnStartup(System.Windows.StartupEventArgs)上
在System.Windows.Application.b__1(System.Object)中
位于System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate、System.Object、Int32)
位于MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object、System.Delegate、System.Object、Int32、System.Delegate)
在System.Windows.Threading.DispatcherOperation.InvokeImpl()中
位于System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(System.Object)
位于System.Threading.ExecutionContext.runTryCode(System.Object)
在System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuarantedCleanup(TryCode,CleanupCode,System.Object)中
位于System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext、System.Threading.ContextCallback、System.Object)
在System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext,System.Threading.ContextCallback,System.Object,布尔值)
在System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext,System.Threading.ContextCallback,System.Object)上运行
在System.Windows.Threading.DispatcherOperation.Invoke()中
在System.Windows.Threading.Dispatcher.ProcessQueue()中
位于System.Windows.Threading.Dispatcher.WndProcHook(IntPtr、Int32、IntPtr、IntPtr、Boolean ByRef)
位于MS.Win32.hwndwapper.WndProc(IntPtr、Int32、IntPtr、IntPtr、Boolean ByRef)
位于MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
位于System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate、System.Object、Int32)
位于MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object、System.Delegate、System.Object、Int32、System.Delegate)
位于System.Windows.Threading.Dispatcher.InvokeImpl(System.Windows.Threading.DispatcherPriority,System.TimeSpan,System.Delegate,System.Object,Int32)
在MS.Win32.HwndSubclass.SubclassWndProc(IntPtr,Int32,IntPtr,IntPtr)
位于MS.Win32.unsafentivemethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
位于System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
位于System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame)
位于System.Windows.Application.RunDispatcher(System.Object)
位于System.Windows.Application.RunInternal(System.Windows.Window)
在System.Windows.Application.Run(System.Windows.Window)中
在MyProgram.App.Main()上

有人对如何解决这个问题有什么建议吗。NET Framework 4.0已安装在我的Windows XP计算机上。VS2017中是否有需要更改的设置?

主要问题是在Visual Studio目标平台中,它必须是
X86
,否则在xp中无法工作。其他人认为看起来还可以

您是否有一行代码试图设置
SecurityProtocol
?也许是Tls12?如果你使用TLS,@itsme86是的。在App.xaml.cs中的
onstart
方法中,我有以下行:
ServicePointManager.SecurityProtocol=(SecurityProtocolType)3072//TLS 1.2
现在就安装更新、设置注册表项并测试应用程序。更大的问题是,当供应商很久以前就已经不再支持win xp时,为什么还要支持win xp