Select to view content in your preferred language

Server 10.1 SOE .NET Samples Problem

4833
15
08-29-2012 02:34 AM
RobertJones2
Regular Contributor
Hi all

I'm trying to build one/any of the .NET REST SOE samples in the SDK, but keep hitting the same problem.

For example - I open the NetFindNearFeaturesRestSOE sample, and try to build the project but the following error is produced by Visual Studio:

'Index (zero based) must be greater than or equal to zero and less than the size of the argument list'

Looking a little deeper this seems to relate to the MSBUILD file ESRI.ArcGIS.AddIns.Server.targets, and specifically the GenerateServerAddInXml task - it looks like this task/underlying .NET class is not accessible to the build process, for some reason.

Running MSBUILD /v:diagnostic against the project yields the following error:

C:\Program Files (x86)\MSBuild\ESRI\ESRI.ArcGIS.AddIns.Server.targets(37,5): error MSB4062: The "GenerateServerAddInXml" task could not be loaded from the assembly ESRI.ArcGIS.AddIns.SDK, Version=10.1.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86. Could not load file or assembly 'Microsoft.VisualStudio.Shell.9.0, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

So it seems to be this part of ESRI.ArcGIS.AddIns.Server.targets that is of interest:

<!-- Custom MSBuild tasks -->
  <UsingTask AssemblyName="ESRI.ArcGIS.AddIns.SDK, Version=10.1.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86" TaskName="PackageAddIn" />
  <UsingTask AssemblyName="ESRI.ArcGIS.AddIns.SDK, Version=10.1.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86" TaskName="ValidateServerAddInXMLTask" />
  <UsingTask AssemblyName="ESRI.ArcGIS.AddIns.SDK, Version=10.1.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86" TaskName="ConvertToRelativePath" />
  <UsingTask AssemblyName="ESRI.ArcGIS.AddIns.SDK, Version=10.1.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86" TaskName="ResolveAddInReference" />
  <UsingTask AssemblyName="ESRI.ArcGIS.AddIns.SDK, Version=10.1.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86" TaskName="GenerateServerAddInXml" />
  <!-- Set up default zip properties -->
  <PropertyGroup>
    <ZipFileExtension Condition="'$(ZipFileExtension)' == ''">ecfg</ZipFileExtension>
    <ZipIntermediatePath Condition="'$(ZipIntermediatePath)' == ''">$(IntermediateOutputPath)$(ZipFileExtension)\</ZipIntermediatePath>
  </PropertyGroup>

  <PropertyGroup>
 
    <BuildDependsOn>
      $(BuildDependsOn);
      GenerateServerAddInXml;
      PackageArcGISAddInContents;
      RunArcGISPostPackageEvent
    </BuildDependsOn>

    <CleanDependsOn>
      $(CleanDependsOn);
      CleanArcGISAddin
    </CleanDependsOn>
  </PropertyGroup>

  <Target Name="GenerateServerAddInXml">

    <GenerateServerAddInXml ContentFiles="@(AddInContent)" BuildProjectPath="$(ProjectPath)" AssemblyName="$(TargetFileName)" TargetFolder="$(OutDir)" ZipIntermediatePath="$(ZipIntermediatePath)" />
  </Target>


Has anyone seen anything similar, and/or has any suggestions? Is there a problem with the Esri assembly, or might this be a red herring?

All help gratefully received, and at least if no one has a solution someone else searching for the same problem might no feel so lonely 😛

Many thanks
Rob
Tags (2)
0 Kudos
15 Replies
JustinHunter
Regular Contributor
I also get the compile error of "Index (zero based) must be greater than or equal to zero and less than the size of the argument list." whenever I try to compile one of the SOE samples that come with the ArcObjects SDK for .NET.

I've also noticed that I have no Server Object Extensions templates under the ArcGIS template if I attempt to add a new project.

Any ideas?

Edit: In my AssemblyInfo.cs I commented out the following which caused the compile to succeed:
[assembly: AddInPackage("SpatialQueryREST", "69448EFA-C727-4CEC-BDE5-0D0B849D7C87",
    Author = "ESRI",
    Company = "ESRI",
    Date = "03/16/2012 12:00:00 PM",
    Description = ".NET Spatial Query REST SOE Sample",
    TargetProduct = "Server",
    TargetVersion = "10.1",
    Version = "1.0")]

Something tells me this is important, but is there a way to fix this?

Edit2: It was the date.
0 Kudos
ZhilingFei
Emerging Contributor
Thanks Justin.

After I commented out the Date, the error is gone and I can publish the soe to the service.

Zhiling
0 Kudos
MassimilianoGeppi
Esri Contributor
Thanks Justin.

I ve change the date format in my Assembly.cs and now, everything work fine again
( my SO is in Italian Language dd/mm/yyyy). esri soe template wizard create a date in another format (mm/dd/yyyy)
evidently MSBuild, during compilation freak out.

Max
0 Kudos
TrevorHart1
Emerging Contributor
Thanks Justin.

I ve change the date format in my Assembly.cs and now, everything work fine again
( my SO is in Italian Language dd/mm/yyyy). esri soe template wizard create a date in another format (mm/dd/yyyy)
evidently MSBuild, during compilation freak out.

Max


Thanks guys, same problem here in New Zealand. Date format here is DD/MM/YYYY. Instead of commenting out I just changed the date to 01/01/2012 which will work on any date system.
0 Kudos
SergeyMalgin
Emerging Contributor
Thanks guys, same problem here in New Zealand. Date format here is DD/MM/YYYY. Instead of commenting out I just changed the date to 01/01/2012 which will work on any date system.



This is a known issue - SOE templates will always generate a date in US format.
Samples also have a date in US format.
Building this on non US locales produces this error.

We are working on this and plan to fix the problem for 10.2
0 Kudos
SergeyMalgin
Emerging Contributor
Update 2:

A second workaround would be to remove Date property from AssemblyInfo.cs completely. In this case, build will substitute build date/time automatically.
0 Kudos