Visual Studio 2017中Windows Embedded Handheld 6.5项目的UI Designer异常

问题描述 投票:1回答:1

我知道Visual Studio 2017不支持Windows Embedded Handheld 6.5,需要Visual Studio 2005或2008。然而,最近得到了新的硬件仍在运行这个移动操作系统,但无法访问Visual Studio 2008.并不是真的热衷于为一个我不想再开发的平台的一个项目购买它。

我找到了在Windows 10上的Visual Studio 2017中为平台构建项目的解决方法,执行以下操作。并非所有这些步骤都是必要的,因为我正在尝试让它发挥作用。

  1. 安装.NET Compact Framework 2.0 SP2.NET Compact Framework 3.5
  2. 使用OrcaWindows Mobile Developer Toolkit 6.5.3创建转换以删除MSI中的Visual Studio先决条件检查+删除一些无法安装的组件
  3. 安装Power Toys for .NET Compact Framework v3.5然后对于任何抛出的错误都无法在构建项目时提交CompactFramework.targets文件,将安装在C:\ windows \ microsoft.net \ Framework \ v3.5中的.targets文件复制到所需的文件夹中
  4. 下载Windows Compact Samples并使用C:\ windows \ microsoft.net \ Framework \ v3.5 \ msbuild文件构建这些文件工作正常,输出EXE在移动设备上运行正常
  5. 要使用Visual Studio编辑项目,我必须从ProjectTypeGUIDs中删除{4D628B5B-2FBC-4AA6-8C16-197242AEB884}。一旦我将项目从.NET 2.0升级到.NET 3.5,我现在可以在Visual Studio中构建项目,并且它在移动设备上运行良好。 (虽然我手动将文件手动复制到设备)

最后一个问题,不是真正的一个showstopper,但很好修复,是设计师抛出错误

找不到类型'System.Windows.Forms.Form'。请确保引用包含此类型的程序集。如果此类型是开发项目的一部分,请确保使用当前平台或任何CPU的设置成功构建项目。

在这种情况下,项目引用C:\ Program Files(x86)\ Microsoft.NET \ SDK \ CompactFramework \ v3.5 \ WindowsCE \ System.Windows.Forms.dll

将WinDbg连接到Visual Studio,获得以下信息:

:021> sxe -c "!pe;!clrstack" clr
0:021> g
(2504.3c8c): CLR exception - code e0434352 (first chance)
Exception object: 29885a70
Exception type:   System.ComponentModel.Design.Serialization.CodeDomSerializerException
Message:          Could not find type 'System.Windows.Forms.Form'.  Please make sure that the assembly that contains this type is referenced.  If this type is a part of your development project, make sure that the project has been successfully built using settings for your current platform or Any CPU.
InnerException:   <none>
StackTrace (generated):
<none>
StackTraceString: <none>
HResult: 80131501
OS Thread Id: 0x3c8c (0)
Child SP       IP Call Site
00afe48c 7613b802 [HelperMethodFrame: 00afe48c] 
00afe53c 0b13e901 System.ComponentModel.Design.Serialization.CodeDomSerializerBase.Error(System.ComponentModel.Design.Serialization.IDesignerSerializationManager, System.String, System.String)
00afe558 0b13c78d System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(System.ComponentModel.Design.Serialization.IDesignerSerializationManager, System.CodeDom.CodeTypeDeclaration)
00afe63c 0b138058 System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(System.ComponentModel.Design.Serialization.IDesignerSerializationManager)
00afe650 1950b386 Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(System.ComponentModel.Design.Serialization.IDesignerSerializationManager)
00afe680 0efb22e5 System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(System.ComponentModel.Design.Serialization.IDesignerLoaderHost)
00afe6b4 0efb1f02 System.ComponentModel.Design.DesignerHost.BeginLoad(System.ComponentModel.Design.Serialization.DesignerLoader)
00afe6e0 0efb1d51 System.ComponentModel.Design.DesignSurface.BeginLoad(System.ComponentModel.Design.Serialization.DesignerLoader)
00afe6f0 19509608 Microsoft.VisualStudio.Design.DesignerService.Microsoft.VisualStudio.Designer.Interfaces.IVSMDDesignerService.CreateDesigner(System.Object, System.Object)
00afe72c 77240423 Microsoft.VisualStudio.LanguageServices.Implementation.AbstractEditorFactory.CreateEditorInstance(UInt32, System.String, System.String, Microsoft.VisualStudio.Shell.Interop.IVsHierarchy, UInt32, IntPtr, IntPtr ByRef, IntPtr ByRef, System.String ByRef, System.Guid ByRef, Int32 ByRef)
00afe7a4 5b1be1ba DomainNeutralILStubClass.IL_STUB_COMtoCLR(Int32, IntPtr, IntPtr, IntPtr, Int32, Int32, IntPtr, IntPtr, IntPtr, IntPtr, IntPtr)
00afe8a4 713ceec4 [ComMethodFrame: 00afe8a4] 
00afefe0 713ceec4 [InlinedCallFrame: 00afefe0] 
00afefdc 5b1d0174 DomainNeutralILStubClass.IL_STUB_CLRtoCOM(UInt32, System.Guid ByRef, UInt32, UInt32, IntPtr, IntPtr)
00afefe0 5b3831d7 [InlinedCallFrame: 00afefe0] Microsoft.VisualStudio.Shell.Interop.IVsUIHierarchy.ExecCommand(UInt32, System.Guid ByRef, UInt32, UInt32, IntPtr, IntPtr)
00aff054 5b3831d7 Microsoft.Internal.VisualStudio.PlatformUI.HierarchyUtilities+c__DisplayClass35_0.b__1()
00aff07c 5b35d1e0 Microsoft.VisualStudio.ErrorHandler.CallWithCOMConvention(System.Func`1, Boolean, Boolean)
00aff0a8 5b379063 Microsoft.Internal.VisualStudio.PlatformUI.HierarchyUtilities.ExecHierParentChain(Microsoft.VisualStudio.Shell.IVsHierarchyItemManager, Microsoft.VisualStudio.Shell.Interop.IVsUIHierarchy, Microsoft.VisualStudio.Shell.Interop.IVsUIHierarchy, UInt32, System.Guid ByRef, UInt32, UInt32, IntPtr, IntPtr)
00aff0e8 15751277 Microsoft.VisualStudio.PlatformUI.HierarchyItem+HierarchyInvocationController.Invoke(System.Collections.Generic.IEnumerable`1, Microsoft.Internal.VisualStudio.PlatformUI.InputSource, Boolean)
00aff114 292eb2bb Microsoft.Internal.VisualStudio.PlatformUI.InvocationController.Invoke(System.Collections.Generic.IEnumerable`1, Microsoft.Internal.VisualStudio.PlatformUI.InputSource, Boolean, System.Func`2)
00aff178 292eb1a2 Microsoft.Internal.VisualStudio.PlatformUI.InvocationController.Invoke(System.Collections.Generic.IEnumerable`1, Microsoft.Internal.VisualStudio.PlatformUI.InputSource, Boolean)
00aff1a0 292eab3a Microsoft.Internal.VisualStudio.PlatformUI.PivotTreeViewItem.InvokeItem(System.Windows.Input.InputDevice)
00aff1d8 292ea13e Microsoft.Internal.VisualStudio.PlatformUI.PivotTreeViewItem.OnMouseLeftButtonDown(System.Windows.Input.MouseButtonEventArgs)
00aff1e8 5a41402c System.Windows.UIElement.OnMouseLeftButtonDownThunk(System.Object, System.Windows.Input.MouseButtonEventArgs)
00aff1fc 5a4766ec System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(System.Delegate, System.Object)
00aff208 59ff969e System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
00aff22c 59ff962f System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
00aff240 59ff92ee System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
00aff2ac 5a418765 System.Windows.UIElement.ReRaiseEventAs(System.Windows.DependencyObject, System.Windows.RoutedEventArgs, System.Windows.RoutedEvent)
00aff2ec 5a413d62 System.Windows.UIElement.OnMouseDownThunk(System.Object, System.Windows.Input.MouseButtonEventArgs)
00aff2fc 5a4766ec System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(System.Delegate, System.Object)
00aff308 59ff969e System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
00aff32c 59ff962f System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
00aff340 59ff92ee System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
00aff3ac 59ff8123 System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
00aff3e8 5a00baa6 System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs)
00aff414 59ff808a System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs, Boolean)
00aff424 5a008c43 System.Windows.Input.InputManager.ProcessStagingArea()
00aff47c 5a008935 System.Windows.Input.InputManager.ProcessInput(System.Windows.Input.InputEventArgs)
00aff48c 5a00889e System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport)
00aff4a4 5a014a92 System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr, System.Windows.Input.InputMode, Int32, System.Windows.Input.RawMouseActions, Int32, Int32, Int32)
00aff4a8 5a798b01 [InlinedCallFrame: 00aff4a8] 
00aff53c 5a798b01 System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr, MS.Internal.Interop.WindowMessage, IntPtr, IntPtr, Boolean ByRef)
00aff5bc 59ff2aab System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
00aff5e0 5ac7ee3b MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
00aff61c 5ac7ed8b MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
00aff62c 5ac7ec52 System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
00aff64c 5ac7eb94 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
00aff690 5ac7d225 System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
00aff6ec 5ac7e72e MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=00afe378 ebx=00000005 ecx=00000005 edx=00000000 esi=00afe438 edi=00000001
eip=7613b802 esp=00afe378 ebp=00afe3d0 iopl=0         nv up ei pl nz ac pe nc
cs=0023  ss=002b  ds=002b  es=002b  fs=0053  gs=002b             efl=00000216
KERNELBASE!RaiseException+0x62:
7613b802 8b4c2454        mov     ecx,dword ptr [esp+54h] ss:002b:00afe3cc=8c7cfc55
0:000> !DumpObj /d 29885a70
Name:        System.ComponentModel.Design.Serialization.CodeDomSerializerException
MethodTable: 0b1612a4
EEClass:     1962f90c
Size:        88(0x58) bytes
File:        C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Design\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Design.dll
Fields:
      MT    Field   Offset                 Type VT     Attr    Value Name
6fc91d64  400028e        4        System.String  0 instance 00000000 _className
6fc90200  400028f        8 ...ection.MethodBase  0 instance 00000000 _exceptionMethod
6fc91d64  4000290        c        System.String  0 instance 00000000 _exceptionMethodString
6fc91d64  4000291       10        System.String  0 instance 2988581c _message
6fca0864  4000292       14 ...tions.IDictionary  0 instance 00000000 _data
6fc91eac  4000293       18     System.Exception  0 instance 00000000 _innerException
6fc91d64  4000294       1c        System.String  0 instance 0a76e208 _helpURL
6fc92104  4000295       20        System.Object  0 instance 00000000 _stackTrace
6fc92104  4000296       24        System.Object  0 instance 00000000 _watsonBuckets
6fc91d64  4000297       28        System.String  0 instance 00000000 _stackTraceString
6fc91d64  4000298       2c        System.String  0 instance 00000000 _remoteStackTraceString
6fc93c04  4000299       3c         System.Int32  1 instance        0 _remoteStackIndex
6fc92104  400029a       30        System.Object  0 instance 00000000 _dynamicMethods
6fc93c04  400029b       40         System.Int32  1 instance -2146233087 _HResult
6fc91d64  400029c       34        System.String  0 instance 00000000 _source
6fc910f8  400029d       44        System.IntPtr  1 instance        0 _xptrs
6fc93c04  400029e       48         System.Int32  1 instance -532462766 _xcode
6fc4b104  400029f       4c       System.UIntPtr  1 instance        0 _ipForWatsonBuckets
6fc9a014  40002a0       38 ...ializationManager  0 instance 29885ac8 _safeSerializationManager
6fc92104  400028d       5c        System.Object  0   shared   static s_EDILock
    >> Domain:Value  00e2ad28:0a91e320 <<
6ef4cc74  40009d8       50 ...om.CodeLinePragma  0 instance 00000000 linePragma

想知道是否有任何可用于消除最终问题的策略建议,或者更具体地解决设计师正在寻找的问题?

c# visual-studio windows-mobile windbg windows-embedded-compact
1个回答
1
投票

我找到的当前解决方法有效:

  1. 创建新项目并选择.NET Framework 3.5然后选择模板 - > Visual C# - > Windows经典桌面 - > Windows窗体应用程序(.NET Framework)
  2. 根据需要构建应用程序和GUI界面。备份这个.csproj文件,我将其重命名为_design.csproj
  3. 在文本编辑中打开.csproj并为紧凑框架程序集添加提示路径,并删除紧凑框架中不存在的内置.NET程序集引用。
  <ItemGroup>
    <Reference Include="System">
    <HintPath>C:\Program Files (x86)\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE\System.dll</HintPath>
    <Reference Include="System.Core" />
    <HintPath>C:\Program Files (x86)\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE\System.Core.dll</HintPath>
    <Reference Include="System.Xml.Linq" />
    <HintPath>C:\Program Files (x86)\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE\System.Xml.Linq.dll</HintPath>
    <Reference Include="System.Data.DataSetExtensions" />
    <HintPath>C:\Program Files (x86)\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE\System.Data.DataSetExtensions.dll</HintPath>
    <Reference Include="System.Data" />
    <HintPath>C:\Program Files (x86)\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE\System.Data.dll</HintPath>
    <Reference Include="System.Drawing" />
    <HintPath>C:\Program Files (x86)\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE\System.Drawing.dll</HintPath>
    <Reference Include="System.Windows.Forms" />
    <HintPath>C:\Program Files (x86)\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE\System.Windows.Forms.dll</HintPath>
    <Reference Include="System.Xml" />
    <HintPath>zProgram Files (x86)\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE\System.Xml.dll</HintPath>
  </ItemGroup>
  1. 构建项目并更正任何未编译的代码,因为它不存在于紧凑框架程序集中。该项目保存为_build.csproj

现在使用设计器我可以使用_design.csproj但是要为移动平台编译我可以使用_build.csproj

© www.soinside.com 2019 - 2024. All rights reserved.