Исключение UI Designer для проекта Windows Embedded Handheld 6.5 в Visual Studio 2017

Я знаю, что Visual Studio 2017 не поддерживает Windows Embedded Handheld 6.5, и требуется Visual Studio 2005 или 2008. Однако недавно появилось новое оборудование, на котором все еще работает эта мобильная ОС, но у него нет доступа к Visual Studio 2008. И я не очень хочу покупать его для разового проекта для платформы, для которой я никогда не хочу разрабатывать снова.

Я нашел обходной путь для создания проектов для платформы в Visual Studio 2017 в Windows 10, выполнив следующие действия. Не все эти шаги могут быть необходимы, так как я экспериментировал, чтобы заставить это работать.

  1. Установите .NET Compact Framework 2.0 SP2 и . NET Compact Framework 3.5
  2. Использовал Orca для создать преобразование для Windows Mobile Developer Toolkit 6.5.3 удалить предварительную проверку Visual Studio в MSI + удалить некоторые компоненты, которые не удалось установить
  3. Установлен Power Toys для .NET Compact Framework v3.5 Затем для любой возникшей ошибки файл CompactFramework .targets при создании проектов скопировал файлы .targets, установленные в C: \ windows \ microsoft.net \ Framework \ v3.5, в требуемый папка
  4. Скачал образцы Windows Compact и собрал их с файлом C: \ windows \ microsoft.net \ Framework \ v3.5 \ msbuild работает нормально, а выходной EXE отлично работает на мобильном устройстве
  5. Чтобы использовать Visual Studio для редактирования проекта, мне пришлось удалить {4D628B5B-2FBC-4AA6-8C16-197242AEB884} из ProjectTypeGUID. Теперь я могу создавать проект в Visual Studio после обновления проектов с .NET 2.0 до .NET 3.5, и он отлично работает на мобильных устройствах. (Хотя в настоящее время я копирую файл на устройство вручную)

Последняя проблема, которая на самом деле не является препятствием, но которую было бы неплохо исправить, - это ошибка дизайнера.

Не удалось найти тип "System.Windows.Forms.Form". Убедитесь, что имеется ссылка на сборку, содержащую этот тип. Если этот тип является частью вашего проекта разработки, убедитесь, что проект был успешно построен с использованием настроек для вашей текущей платформы или любого процессора.

В этом случае проект ссылается на 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

Интересно, есть ли какие-либо предложения по стратегиям, которые можно было бы использовать для устранения этой последней проблемы, или более конкретно проработать то, что ищет дизайнер?


person Malcolm McCaffery    schedule 17.07.2017    source источник


Ответы (1)


Текущий обходной путь, который я нашел, работает:

  1. Создайте новый проект и выберите .NET Framework 3.5, затем Templates -> Visual C # -> Windows Classic Desktop -> Windows Forms App (.NET Framework)
  2. Создайте приложение и графический интерфейс по желанию. Сделайте резервную копию этого файла .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

person Malcolm McCaffery    schedule 18.07.2017