Repairing Scripts if a Specific .NET Function Cannot be Found
When running an existing script in ZEN 3.11 which was created for an older ZEN version, you may encounter an error message that a specific .Net function cannot be found. In such cases, you need to add additional imports to the script.
- Open your browser and a search engine and search for .NET and the name the function.
- Search results are displayed.
- Select and open the result for the Microsoft Learn page.
- The information for the function are displayed.
- Make sure that in the top left the Version is set to .NET8.
- The information for the function for .NET8 are displayed.
- Check the displayed information in which Assembly the function is based.
- Go back to ZEN and open your script in the editor.
- Your script is displayed.
- Add clr.AddReferenceByPartialName("New assembly name").
- You have added the required import to your script.
Example: Importing FileVersionInfo
For this example you need to import an assembly for the FileVersionInfo function to your script.
- Open your browser and a search engine and search for .NET FileVersionInfo.
- Search results are displayed.
- Select and open the result for the Microsoft Learn page.
- The information for the function are displayed.
- Make sure that in the top left the Version is set to .NET8.
- The information that for .NET 8 FileVersionInfo has moved to the assembly System.Diagnostics.FileVersionInfo.dll is displayed.
- You can double check if you change Version to .NET Framework 4.5.
- The information displays that for .NET Framework 4.5 the function was in the System.dll.
- Go back to ZEN and open your script in the editor.
- Your script is displayed.
- Add clr.AddReferenceByPartialName(System.Diagnostics.FileVersionInfo).
- You have added the required import to your script.
ABOUT ZEISS
Impressum
Carl-Zeiss-Strasse 22
73447 Oberkochen
Germany
Legal