Building my 1st plug-in with Visual Studio 2017 (part 2)

Continuation of part 1 (https://community.sdl.com/developers/language-developers/f/61/t/14327).

I have gotten the basic plug-in working and am now on this step of the tutorial: http://producthelp.sdl.com/SDK/BatchTaskApi/1.0/html/1daf8da9-ea35-4dc7-a92b-31d20d9c8537.htm

The tutorial says to add a reference to 'Sdl.Core.Globalization', but VS17 says there is no 'Globalization' under 'Sdl.Core.Globalization'. There is a further error message as follows:

You must add a reference to assembly 'Sdl.Core.Globalization, Version=1.8.0.0, Culture=neutral, PublicKeyToken=c28cdb26c445c888'.

How can I get 'Sdl.Core.Globalization'?

EDIT 1: I just found 'Sdl.Core.Globalization.dll' in a number of places, e.g. 'C:\Program Files (x86)\SDL\SDL Trados Studio\Studio5'. How do I include it in my project? I guess I would need the header file!?

EDIT 2: Now I see that VS17 has 'Project | Add reference...'. But I have not yet found 'Sdl.Core.Globalization' there. Is that how to get the reference?

Thanks,

Gary Hess

Parents
  • Hi Gary,

    Yes, "Project > Add Reference" is correct.
    From there, click "Browse" and go to "C:\Program Files (x86)\SDL\SDL Trados Studio\Studio5" to select the DLL.

  • Thanks, that worked!

    Now when I try to compile, I am getting this error:

    'FileReader' does not contain a constructor that takes 2 arguments

    The class is defined as follows:

    public class FileReader : AbstractBilingualContentProcessor { ... }

    However, there are two arguments when a new FileReader object is created:

    FileReader _task = new FileReader(_settings, projectFile.LocalFilePath);

    Any idea why this is not working? I am trying to dig into this problem but I don't have much experience with C# and Visual Studio.

    EDIT: After reading about constructors in C#, I added the following line inside of the 'FileReader' class and the error has disappeared. But is there a better solution?

    public FileReader(MyCustomBatchTaskSettings _taskSettings, string _inputFilePath) { }

    Thanks,

    Gary

  • Your solution for the error is correct. Now you need to make sure that your class and base class (AbstractBilingualContentProcessor) uses the values.

    Romulus Crisan | Translation Productivity Development Manager | SDL | (twitter) @cromica_82 | (blog) http://www.romuluscrisan.com/

  • It took me a while to realize it, but this sample project (http://producthelp.sdl.com/SDK/BatchTaskApi/1.0/html/d4c61662-0dc9-4f3c-8bed-f7cfc3b3b27d.htm) is not complete. What I mean is that it would take a lot of additional code to make a working example of it.

    Question: I wonder if there is a complete version somewhere? I don't see it in the sample projects in 'C:\ProgramData\SDL\SDK 5.0'. Or a complete version of any batch task?

Reply
  • It took me a while to realize it, but this sample project (http://producthelp.sdl.com/SDK/BatchTaskApi/1.0/html/d4c61662-0dc9-4f3c-8bed-f7cfc3b3b27d.htm) is not complete. What I mean is that it would take a lot of additional code to make a working example of it.

    Question: I wonder if there is a complete version somewhere? I don't see it in the sample projects in 'C:\ProgramData\SDL\SDK 5.0'. Or a complete version of any batch task?

Children
No Data