Solid Edge macro -- files in directory other than executable -- are they needed?

PLM World Member Legend PLM World Member Legend
PLM World Member Legend

A quick question that will probably be trivial to answer...

 

I have created a small Solid Edge macro in the form of a console application.  It all worked just fine during debugging and so I have now created a release build.  Now, in the Release folder some additional files other than the executable were generated by Visual Studio Express.  So the files are generally as follows:

 - the executable (.exe)

 - the ini file (used by the executable)

 

Extra files:

 - an exe.config file

 - a pdb file

 - a vshost.exe file

 - a vshost.exe.config file

 - a vshost.exe.manifest file

 - an xml file

 

I copied just the executable and ini file to a separate directory and they seem to run just fine in Solid Edge.  So my question is:  are the extrra files needed?  If not, it is no big deal to copy the other files through but I am curious.  This is my first foray into Visual Studio.

 

 

Cheers,

 

Chris

10 REPLIES

Re: Solid Edge macro -- files in directory other than executable -- are they needed?

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

Not needed

.pdb (Program Debug Database)

*.vshost.exe.*

 

Needed

*.exe

Interop.*.dll

*.exe.config (Application Configuration)

 

Not sure where the .ini came from. That is a really old file extension and generally not used in .NET in favor of .xml.

Jason Newell
Applications Architect
www.jasonnewell.net

Re: Solid Edge macro -- files in directory other than executable -- are they needed?

PLM World Member Legend PLM World Member Legend
PLM World Member Legend

Thanks Jason. The ini file is just a text file containing some settings that is read in and used by the macro.  I guess I could have just as easily made the file extension .txt.  It doesn't affect anything.

 

So what exactly does the exe.config file do?  From what I can gather it stores settings for the executable that can be changed without having to recompile the executable.  But in my case there is no requirement for any program settings to be changed.  Is there a setting in Visual Studio that governs whether or not an exe.config file is generated?

Re: Solid Edge macro -- files in directory other than executable -- are they needed?

Pioneer
Pioneer

I never need the *.exe.config file, you should be able to run the program without it.

Re: Solid Edge macro -- files in directory other than executable -- are they needed?

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

You are correct about the exe.config. Your program will execute without it unless you've written code that reads it or are referencing a 3rd party library that reads it (log4net comes to mind).

 

Also note that there are OS specific elements that can appear in the exe.config. For example:

 

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1"/>
  </startup>
</configuration>

Tells the OS what version of the .NET runtime your application supports. If this is present, the OS will first verify that the stated supported runtime is available on the machine before trying to execute the application. So rather than your app crashing, the OS will inform the user that the app minumum requirements have not been met. I'm sure there are other features but you get the idea.

 

The exe.config gets created during the build process if the compiler finds an App.config in the project.

Jason Newell
Applications Architect
www.jasonnewell.net

Re: Solid Edge macro -- files in directory other than executable -- are they needed?

PLM World Member Legend PLM World Member Legend
PLM World Member Legend

Thanks for that.  I had a look at the project in Visual Studio again and the app.config is there and is almost identical to the example.  I used the "Console Application" template and it creates an exe.config file by default.

Re: Solid Edge macro -- files in directory other than executable -- are they needed?

PLM World Member Legend PLM World Member Legend
PLM World Member Legend

jnewell wrote:

You are correct about the exe.config. Your program will execute without it unless you've written code that reads it or are referencing a 3rd party library that reads it (log4net comes to mind).

 

Also note that there are OS specific elements that can appear in the exe.config. For example:

 

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1"/>
  </startup>
</configuration>

Tells the OS what version of the .NET runtime your application supports. If this is present, the OS will first verify that the stated supported runtime is available on the machine before trying to execute the application. So rather than your app crashing, the OS will inform the user that the app minumum requirements have not been met. I'm sure there are other features but you get the idea.

 

The exe.config gets created during the build process if the compiler finds an App.config in the project.


Hi Jason,

 

The macro is a com executable and it is run via. a button on the SE ribbon.  It requires .NET v4.5.  Now a user had it on a machine with .NET v4.0 and when he tried to run it from SE it started and stopped straight away as you might expect.  Is there a way of getting the macro to flag up an error message similar to what the Operating System would do if the macro executable was simply double-clicked from Windows Explorer?

 

 

Cheers,

 

Chris

Re: Solid Edge macro -- files in directory other than executable -- are they needed?

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

Chris,

 

You bring up a good point. I was thinking more along the lines of a normal .NET app with a Main() but in this case, Solid Edge is trying to create a COM instance from your assembly. The .NET loader fails since the target version of the framework is not installed.

 

Couple of options I can think of.

 

  1. Create an installer to ensure the correct version of the runtime is installed.
  2. Lower your required .NET framework version to 4.0 if you can.
Jason Newell
Applications Architect
www.jasonnewell.net

Re: Solid Edge macro -- files in directory other than executable -- are they needed?

PLM World Member Legend PLM World Member Legend
PLM World Member Legend

Hi Jason,

 

Create an installer -- now that is getting fancy!!!  Can you point me towards any software for creating an installer?

 

Ax far as the net version is installed I did not explicitly specify anything there.  I presume it was taken from the version installed on my machine -- where I wrote the macro.  Is there any way to lower the .NET version requirement to 4.0 other than compiling the macro on a machine with .NET 4.0 installed?

 

 

Chris

Re: Solid Edge macro -- files in directory other than executable -- are they needed?

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

Chris,

 

The target framework is defined in the project properties. Also, when creating a new project, the target framework is available as a dropdown in the new project dialog. You would have to recompile and redeploy with this approach.

 

Installers... That's a big one. So many to pick from. Some free, some paid. My experience is that if you're going to the installer route, you're almost always better off going with a paid solution. I will mention InstallShield Limited Edition that comes with Visual Studio 2012 or greater. I haven't personally used it but it does look promising even though it's limited.

Jason Newell
Applications Architect
www.jasonnewell.net