Siemens.Collaboration.Net.TiaPortal.Openness.Resolver 1.0.1685432245

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Siemens.Collaboration.Net.TiaPortal.Openness.Resolver --version 1.0.1685432245                
NuGet\Install-Package Siemens.Collaboration.Net.TiaPortal.Openness.Resolver -Version 1.0.1685432245                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Siemens.Collaboration.Net.TiaPortal.Openness.Resolver" Version="1.0.1685432245" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Siemens.Collaboration.Net.TiaPortal.Openness.Resolver --version 1.0.1685432245                
#r "nuget: Siemens.Collaboration.Net.TiaPortal.Openness.Resolver, 1.0.1685432245"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Siemens.Collaboration.Net.TiaPortal.Openness.Resolver as a Cake Addin
#addin nuget:?package=Siemens.Collaboration.Net.TiaPortal.Openness.Resolver&version=1.0.1685432245

// Install Siemens.Collaboration.Net.TiaPortal.Openness.Resolver as a Cake Tool
#tool nuget:?package=Siemens.Collaboration.Net.TiaPortal.Openness.Resolver&version=1.0.1685432245                

TIA Portal Openness Assembly Resolver

Assembly Resolver

The assembly resolver must be registered before any access to Siemens.Engineering classes is done, e.g. on startup of the app.

static void Main(string[] args)
{
    Api.Global.Openness().Initialize();
    RunTiaPortal();
}

private static void RunTiaPortal()
{
    var tiaPortal = new TiaPortal(TiaPortalMode.WithUserInterface);
}

The resolver will

  • check the registry for TIA Portal installations
  • running processes
  • environment variable 'TiaPortalLocation'

It will collect all Siemens.Engineering assembly found and automatically resolve the correct assembly. E.g. the app was build using TIA Openness V16, at runtime TIA Portal V17 is found. The resolver will automatically resolve the V16 assembly from the V17 installation. This behaviour can be changed by providing an assembly selector:

Api.Global.Openness().Initialize(engineeringAssemblySelector: assemblies => assemblies.First());

In this example assemblies is the list of all found Siemens.Engineering assemblies ordered by version. In this case the latest version is selected. or a fixed TIA Portal Version

Api.Global.Openness().Initialize(tiaMajorVersion: 16);

TIA Portal processes

When executing TiaPortal.GetProcesses() only the processes of the same version are found. This means, if the app is supporting multiple versions, only the TIA Portal processes of the resolved assembly will be returned. When calling Process.GetProcessesByName("Siemens.Automation.Portal.exe") besides TIA Portal processes also PLCSIM and other processes are returned. To get all TIA Portal processes use GetTiaPortalProcesses instead.

var tiaPortalProcesses = Api.Global.Openness().GetTiaPortalProcesses();

This will find all processes and load the Siemenes.Engineering assembly in a temporary app domain. Within this app domain the TiaPortal.GetProcesses() method will be called and the found processes are returned. After that, the app domain is unloaded. Afterwards the assembly resolver can be hooked to the selected TIA Portal process and attach to the instance

Api.Global.Openness().Initialize(process);

Openness user group

In order to be able to connect to the TIA Portal Openness API the user needs to be a member of the windows group Siemens TIA Openness.

Check if user is in the group

if (Api.Global.Openness().IsUserInGroup())
   // user is in group
else
   // not in group

Add the user to the group

if (await Api.Global.Openness().AddUserToGroupAsync())
   // user was added
else
   // user not added

When executing Api.Global.Openness().AddUserToGroupAsync() a new process will be opened and admin privileges will be requested. If admin privileges are granted, the user will be added, otherwise false. For this change to take effect the user needs to re-login.

Product Compatible and additional computed target framework versions.
.NET Framework net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Siemens.Collaboration.Net.TiaPortal.Openness.Resolver:

Package Downloads
Siemens.Collaboration.Net.TiaPortal.Openness.Extensions

Provides extension methods for TIA Portal V19 openness development

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.1725480302 414 9/6/2024
1.0.1685432245 2,143 5/30/2023
1.0.1675251470 963 2/1/2023