Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Signing an NXOpen .NET file

Status
Not open for further replies.

sumBuddy

Mechanical
Jun 3, 2011
31
Hello Everyone -

I am attempting to sign my first program with the NXOpen .NET author, but I keep getting an error when I attempt to run the SignLibrary command in command prompt. The error reads:

System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT:0x8007000B) at SignLibrary.JAM_SESSION_reserve_dotnet_author_license() as SignLibrary.Main(String[] args)

I can run my application in NX6.0.4.3 because the Log File reads:

System.Exception: Invalid NX signature found
at NXOpen.Utilities.BaseSession.verifyAssemblyData()
at NXOpen.Utilities.BaseSession.InitLicense()
Validation failed but author license exists - loading library.

I am using Visual Studio 2010 Express to embedd the resource file as "embedded resource", compile my source code and then attempt to run the SignLibrary command. Should I have an updated resource file when the Author license was added to my system? (When I open NXSigningResource.res in Notepad, the file just has two lines of text saying NXAUTHBLOCK, but no other information, is this correct?)

I do not know what I am doing wrong. I have attempted to follow the documentation that came with NX.

Any help would be greatly appreciated.

Thanks in advance,


sumBuddy (Mechanical)

--------------------------------------------------------------------------------
"I would like to change the world, but I can't find the source code."
 
Replies continue below

Recommended for you

I still use Visual Studio 2008. In 2008 one has several settings for compiling. One of these is to compile with embedded resource. If I did this it always caused errors with signing resource file. To get the signing to work correctly I need to just add the resource file and to set compiling as just compiling i.e. no embedded resource. The build is then fine and the signing process work fine.

Hope this helps.

Frank Swinkels
 
Hello Frank -

Thanks for replying. I tried what you have suggested, and if I switch the "NXSigningResource.res" to build action "compile", then Visual Studio throws out an error when it attempts to compile by saying that "Declaration expected." (Visual Studio is looking at the resource file as a code file with this option.) So after that, I tried every other option available (I even tried: none)- Same error displayed everytime at the SignLibrary command prompt.

I called GTAC, and they said that the only Visual Studio version that is compatible with NX6 is VS2005 SP1, but also believes that the Express version will work. Well, I tried VS2005 Express, VS2008 Express, and none of these versions gave any success. I am waiting on my IT to install the Professional version of VS2005, but do not really believe that this is the problem.

Frank, do you have any other suggestions? Do you use the NX wizards that were designed for Visual Studio, or do you create a new project from scratch? I do not have to include any other references in my project especially for signing a program, do I?

Any other suggestions or help would be great.

Thanks,


sumBuddy (Mechanical)

--------------------------------------------------------------------------------
"I would like to change the world, but I can't find the source code."
 
All I do for programs that need to be signed, from the menu bar, I select Project-> "project name" Properties. I then select Resources from the LHS options. Then from its options (across the top I select Add Resources. From the pulldown menu of Add Resources I select Add Existing file and add NXSigningResource.res which is located in the ...NX(version)\ugopen directory. Note that it may be necessary to have the file mask set to all file types (*.*).

Finally after building your .dll or .exe you need to execute SignLibrary which is in the ugii directory (from a command window that has access to the ugii directory).

Hope this helps.

Frank Swinkels

 
Frank -

Thanks again for your help, but I resolved the issue with the assistance of GTAC personnel (thanks Amy!).

I never like to leave a thread unsolved for future reference, so let me document the problem and solution. I am running a 32-bit version of NX6.0.4.3 on a 64-bit machine. The SignLibrary executable will not return an error in this situation.

NX6.0.5 has a fix for this, and GTAC helped me swap out the problem file (run_managed.exe in the UGII directory) and the SignLibrary executable worked perfectly.

sumBuddy (Mechanical)

--------------------------------------------------------------------------------
"I would like to change the world, but I can't find the source code."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor