Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Inquiries about error during build for RoboDK C# API.

#1
Hello.

When building the RoboDK C# API,
There are some errors related to Registry Key and some other errors, so I would like to know how to solve them.

Severity code description Project file line non-display error (suppression) status
Error CS0103 The name 'RegistryKey' does not exist in the current context. RoboDkApi (netcoreapp3.1) C:\Tools\RoboDK-API-master\C#\API\RoboDK.cs 445 

Severity code description Project file line non-display error (suppression) status
Error CS0103 The name 'RegistryHive' does not exist in the current context. RoboDkApi (netcoreapp3.1) C:\Tools\RoboDK-API-master\C#\API\RoboDK.cs 445 

Severity code description Project file line non-display error (suppression) status
Error CS0103 The name 'RegistryView' does not exist in the current context. RoboDkApi (netcoreapp3.1) C:\Tools\RoboDK-API-master\C#\API\RoboDK.cs 445 

Severity code description Project file line non-display error (suppression) status
Error NETSDK1005 The asset file 'C:\Tools\RoboDK-API-master\C#\API\obj\project.assets.json' does not have a target of 'net6.0-window'. Make sure that the restore has been executed and that 'net6.0-windows' is included in the Target Frameworks of the project. RoboDkApi C:\Program Files\dotnet\sdk\7.0.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets 266

The VisualStudio is using 2022 version,
The framework is using net45,
The registry is using Microsoft.Win32.Registry 4.7.0.

Help me Please!

-JuYung Kang
#2
You should be able to compile and use the API without issues by removing the lines that give you compilation problems. If you installed RoboDK in the default path you could simply leave the RoboDKInstallPath function as shown here:

Code:
public static string RoboDKInstallPath()
{
    const string defaultPath = @"C:\RoboDK\bin\RoboDK.exe";
    return File.Exists(defaultPath) ? defaultPath : null;
}

You can also update the install path if needed. However, this function is never called if you have RoboDK open.

We'll take a deeper look to properly solve this issue.
#3
(11-10-2023, 10:20 AM)Albert Wrote: You should be able to compile and use the API without issues by removing the lines that give you compilation problems. If you installed RoboDK in the default path you could simply leave the RoboDKInstallPath function as shown here:
Code:
public static string RoboDKInstallPath()
{
    const string defaultPath = @"C:\RoboDK\bin\RoboDK.exe";
    return File.Exists(defaultPath) ? defaultPath : null;
}

You can also update the install path if needed. However, this function is never called if you have RoboDK open.
We'll take a deeper look to properly solve this issue.

Thank you. But,
The same error occurs when the path of RoboDK.exe is properly corrected.
Is there anything I need to set in the 'Microsoft.PackageDependencyResolution.target' file initially when using the API?
If build it, netcore app 3.1 only dll won't be generated, so please answer if it's a problem related to this.
If not, how should we solve this problem?
#4
Are you using the Net Framework or Net Core?

You can try removing this dependency:
Code:
using System.Registry;
And any commands that require it.

You could also try with this pull request which adds support for .Net Core 3.0 to the C# API:
https://github.com/RoboDK/RoboDK-API/pull/38
  




Users browsing this thread:
2 Guest(s)