Compact 2013 Ebook

17.9a Merge Web References
Created by djones on 7/5/2013 8:02:09 AM

Merging the Web References from a VS2008 SmartDevice project into a Compact 2013 C# project

As discussed in the previous article, 17.12, there is an issue with Compact 2013 C# apps that are a client of a web service in that the VS2012 Visual Designer does not support adding a web reference for .NET CF 3.9 apps. The workaround is to build a similar app as SmartDevice project in VS2008 and to manually copy the required the required bits into the Compact 2013 project. Whilst overview of how to do this is contained in that previous article, it is lacking in detail. This article provides that detail.

NOTE: On this page, a space has been added in front of the / character in closing XML tags. This is because of HTML escape character sequences.

(A) Comparing the project files

The .csproj files are essentially XML and therefore viewable in a text editor or XML editor. To do so it is simplest to copy the files and give them a .txt or .xml extension depending upon which editor is to be used. To compare the two files copy them to a temporary folder and give them a .txt or .xml extension. Open them both side-by-side in the same editor and visually inspect both to make a comparison. Focus upon the XML structure of the files and so an XML editor may be more conducive to determining the differences.

The structure of the project file from an XML perspective is:

<Project DefaultTargets="Build" xmlns=http://…/developer/msbuild/2003 ToolsVersion="3.5">

·         PropertyGroups

·         ItemGroups

·         Imports

< /Project>

Its interesting that the  Compact 2013 ToolsVersion is 4.0, not 3.9. The TargetFrameworkVersion is 3.9 though.

 

The differences center upon the ItemGroups. The second ItemGroup requires the insertion of an item at its end. Also a number of ItemGroups need to be inserted after that second ItemGroup..

(B) Comparing the project files

A text comparator such as BeyondCompare. An XML comparator will give more structure to the comparison. In this example, the XML comparator, DiffDog , was used:

compare

  • The left hand code is the Compact 2013 project file. The right hand code is the VS2008 project file
  • There is a question of what differences can be ignored. This can be determined by trail and error but suffice to say, version numbering etc. can be safely ignored.
  • The first thing to do is to find the anchor points around the web service metadata.
  • In the above example, the encircled red code is common to both and is followed by some web service metadata in the right-hand code.
  • The encircled purple code is common to both and is the lower limit of metadata.
  • There is also a an intervening line of code common to both, encircled in green
  • This leaves two segments of code to insert into the Compact 2013 project file:
    • Insert 1: This is an item to insert at the bottom of the second ItemGroup
    • Insert2: This is the web service ItemGroups that are additional ItemGroups to insert

(C) An Example

1. Make sure you have backed up the project file.

2. Open the Managed Code project file ( .csproj ) in Notepad or another text editor.

3. Locate the second ItemGroup, It starts with:

Second ItemGroup
xml version="1.0" encoding="utf-8" ?>
<ItemGroup>
  <Compile Include="Form1.cs">
    <SubType>Form< /SubType>
  Compile>
 ....
 ....
< /ItemGroup>
where Form1 is the application form.
This ItemGroup is the second ItemGroup after the one with the references to which .NET libraries to include.

4. At the bottom of that ItemGroup insert the following:

Insert at bottom of second ItemGroup:
  <Compile Include="Web References\WebReference\Reference.cs">
    <AutoGen>True< /AutoGen>
    <DesignTime>True< /DesignTime>
    <DependentUpon>Reference.map< /DependentUpon>
  < /Compile>

5. Then just below that ItemGroup insert the follow ItemGroups:

Additional ItemGroups to insert:
  <ItemGroup>
    <WebReferences Include="Web References\" />
  < /ItemGroup>
  <ItemGroup>
    <WebReferenceUrl Include="http://192.168.2.109/WebSite/Service.asmx">
      <UrlBehavior>Static< /UrlBehavior>
      <RelPath>Web References\WebReference\< /RelPath>
      <UpdateFromURL>http://192.168.2.109/WebSite/Service.asmx< /UpdateFromURL>
      <ServiceLocationURL>
      < /ServiceLocationURL>
      <CachedDynamicPropName>
      < /CachedDynamicPropName>
      <CachedAppSettingsObjectName>
      < /CachedAppSettingsObjectName>
      <CachedSettingsPropName>
      < /CachedSettingsPropName>
    < /WebReferenceUrl>
  < /ItemGroup>
  <ItemGroup>
    <None Include="Web References\WebReference\Service.wsdl" />
  < /ItemGroup>
  <ItemGroup>
    <None Include="Web References\WebReference\Reference.map">
      <Generator>MSDiscoCodeGeneratorGenerator>
      <LastGenOutput>Reference.cs< /LastGenOutput>
    < /None>
    <None Include="Web References\WebReference\Service.disco" />
  < /ItemGroup>

.. where the URL (in two places) is the web service URL.

7. Save and close the file 
8. Reopen the project in VS2012 and check that the web reference is present and usable.

Smile

print

Click here to provide feedback and input

  Comments


Turkish porno izle video site in rokettubeporno izle