Cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted

Re: Retrieve file properties

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

@dosti,

 

it's not working, because the [STAThread] attribute decoration of your Main function is still missing. See correction here:

 

namespace ConsoleApp1
{
    class Program
    {
        [STAThread]
        static void Main(string[] args)
        {
            SolidEdgeFileProperties.PropertySets propertySets = new SolidEdgeFileProperties.PropertySets();
            SolidEdgeFileProperties.Properties properties = null;
            propertySets.Open("path to an assembly");
            properties = (SolidEdgeFileProperties.Properties)propertySets[0];            
            var descriptionProperty = (SolidEdgeFileProperties.Property)properties.get_PropertyByID(2);
            var description = descriptionProperty.Value.ToString();
            propertySets.Close();
        }
    }
}

And also ensure to use x64 configuration instead of AnyCPU. Then your code above will work (just verified).

The exception can't be caught by try-catch, because it's a severe .NET runtime exception.

Kind regards,
Wolfgang Kunert - www.wksyspro.de

Re: Retrieve file properties

Pioneer
Pioneer

You're right.

 

I had already tried with the [STAThread] but not the x64.

 

The problem in the real application was that this code was in a library I did change the platform in the executable project but not in the library.

 

Thanks a lot