Server 10.1 SOE .NET Samples Problem

4107
15
08-29-2012 02:34 AM
RobertJones2
Occasional 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
RichardWatson
Frequent Contributor
I am not working on 10.1 at the moment so I can't comment about the specific problem that you are having.

You are not trying to run Visual Studio 2012, right?
0 Kudos
RobertJones2
Occasional Contributor
No - VS 2010. Seeing this on a couple of different environments - both VS 2010.
0 Kudos
RichardWatson
Frequent Contributor
Post a screen shot of your help about box from Visual Studio.

Can you find the assembly that it is looking for on the machine?

If not, then maybe you are trying to run Express or don't have the required SP installed.  Just guessing.
0 Kudos
KevinGooss
Occasional Contributor
I am able to compile the solution directly using vs2010.
0 Kudos
RobertJones2
Occasional Contributor
Thanks for responses. Good to know there isn't a problem with samples. A shame to know the problem is probably my config!

I do have VC# Express on one of the machines, but not on the other, so don't think that's the problem. I will double check though.
0 Kudos
KevinGooss
Occasional Contributor
Some times there can be issues about the order that things were installed.
Did you install studio or sdk first?
uninstalling one or the other may solve the issue.
i don't know anything about express vs, i have the full blown version.
0 Kudos
RobertJones2
Occasional Contributor
I created an SOE out of the VS template and was able to successfully build and deploy this, so I guess my problem was specific to the samples. Moving ahead once more 🙂
0 Kudos
ZhilingFei
New Contributor
Hi,

I am having this problem even with the VS template. Can someone help me?

Thanks,

Zhiling
0 Kudos
MassimilianoGeppi
Esri Contributor
Hi,

I've the same problem.

When i try to create a plug-ins for desktop the .targets are compiled correctly, and my desktop plug-in is created.
When i try to create a soe for server (using template or sample) the.targets does not compiled, and i  see the error below.

Using "GenerateServerAddInXml" task from assembly "ESRI.ArcGIS.AddIns.SDK, Version=10.1.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86".
Task "GenerateServerAddInXml"
C:\Program Files (x86)\MSBuild\ESRI\ESRI.ArcGIS.AddIns.Server.targets(37,5): error : Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
Done executing task "GenerateServerAddInXml" -- FAILED.
Done building target "GenerateServerAddInXml" in project "RestSOE2.csproj" -- FAILED.

I notice that in the ESRI.ArcGIS.AddIns.SDK in the GAC
1) The first 4 class called in "ESRI.ArcGIS.AddIns.Server.targets" are in this namescpace "ESRI.ArcGIS.AddIns.MSBuild"
2) Only "GenerateServerAddInXml" class is in a Nested namespace "ESRI.ArcGIS.AddIns.SDK.ServerAddins"

It's possible that the my MSBuild does not see classes that are in a nested namespace?

I hope, I have given any information to help me with you to solve this problem.

Thank you in advance.

Max
0 Kudos