Select to view content in your preferred language

Build Solution fails

5646
14
11-17-2009 06:52 AM
JochenManegold
Esri Contributor
I have a installation of ArcGIS Desktop 9.4 and the ArcObjects SDK on a Windows Server 2008 R2 (64 bit). I generated in Visual Studio 2008 a Desktop Class Library from the ESRI Templates and generated a Command based on BaseCommand. If I compile the solution (for the x86 platform), an error occures:
"The command "esriRegasm.exe "C:\Data\jm\JMLib1\JMLib1\bin\x86\Debug\JMLib1.dll" /v 9.4 /p Desktop /s" exited with code -1."
If I run the esriRegasm from the CommandLine - or using the context menu in the explorer - esriRegasm fails with: "Registration failed. Could not write to disk". My account is in the Administrator Group.
0 Kudos
14 Replies
EagerIp
Deactivated User

The link I posted troubleshoots two slightly different problems. The one I'd like you to try is to attach esriRegasm.exe to debug through your project using Visual Studio.

OK. The /e option doesn't give a lot of information. Can you try to debug if the error stems from any of the ComRegisterFunction() inside the failed assembly? You can do so by setting esriRegasm.exe as the debugging external program in Visual Studio. (And it is better if you remove or comment out the BeforeClean/AfterBuild xml from the project file before debugging.)

Under Start Action
------------------
Start external program:
C:\Program Files\Common Files\ArcGIS\bin\ESRIRegAsm.exe

or on a 64 bit OS
C:\Program Files (x86)\Common Files\ArcGIS\bin\ESRIRegAsm.exe

Under Start Options
-------------------
Command line arguments:
"NewFindAcctTool.dll" /p:Desktop /e

Working directory:
{directory of the NewFindAcctTool.dll}


Tips on commenting out BeforeBuild/AfterBuild

  1. Right-click the project in Solution Explorer and choose Unload Project.

  2. After project is unloaded, right-click it again and choose "Edit NewFindAcctTool.xxproj"

  3. The project file will be displayed in raw text format. Locate the following xml section near the bottom of the project file and comment it out (i.e. wrap them between <!-- -->). Save changes and reload to start debugging.

<Target Name="BeforeClean">
  <Exec
    WorkingDirectory="$(CommonProgramFiles)\ArcGIS\bin"
    Command="esriRegasm.exe &quot;$(TargetPath)&quot; /p:Desktop /u /s"
    Condition="Exists('$(TargetPath)')"/>
</Target>
<Target Name="AfterBuild">
  <Exec
    WorkingDirectory="$(CommonProgramFiles)\ArcGIS\bin"
    Command="esriRegasm.exe &quot;$(TargetPath)&quot; /p:Desktop /s"/>
</Target>
0 Kudos
JohnFell
Frequent Contributor
I attempted the suggested debugging procedures and got the following result:

**********************************


ESRIRegAsm::Register
  Command line: "NewFindAcctTool.dll" /p:Desktop /e

  Registry Capture On.
  Registering managed library...
  Managed Exception: Could not load file or assembly 'file:///I:\FELLJ\FellJGIS\
Projects\Development\dotNETProjects\NewFindTool\NewFindAcctTool\NewFindAcctTool\
bin\Debug\newfindaccttool.dll' or one of its dependencies. Operation is not supp
orted. (Exception from HRESULT: 0x80131515)
  Registry Capture Off.

Operation Failed
003B6388

**********************************

Press Enter to continue...


Thank you for your ideas on this issue. Hopefully we can get it figured out. I am using source control using Team Foundation Server. Not sure if that makes a difference.
0 Kudos
RichardWatson
Deactivated User
I see the same fuslogvw message that you do yet EsriRegAsm works for me.

My only other suggestion is as follows:
1) Open Project in Visual Studio and specify the file EsriRegAsm.exe
2) Specify the command line arguments that you need in the project properties
3) In the Debug/Exceptions menu break when any CLR exceptions are thrown

Run it.  Hopefully, you will see the problem.  I am thinking that it might be related to the registration logic you have in the underlying assembly?  If that does not help then I am out of ideas.
0 Kudos
JohnFell
Frequent Contributor
The build is now working properly. I had the project on a mapped network drive. Once I copied the solution and it's folder to my local machine (C:\Microsoft Visual Studios 2010\Projects) it built fine. Thanks to all for your efforts.
0 Kudos
MikeDavies
New Contributor
I know it's a long time ago, but here's a fix to allow us to used share drives:

Edit C:\Program Files (x86)\Common Files\ArcGIS\bin\ESRIRegAsm.exe.config

and add

   <loadFromRemoteSources enabled="true" />

before
  </runtime>

Mike.
0 Kudos