Build a C# “Zivid Hello World” Application in Visual Studio on Windows

이 튜토리얼에서는 Visual Studio 2022에서 Zivid를 사용하여 C# 애플리케이션을 만들고 개발하는 방법을 보여줍니다. 다른 버전의 Visual Studio에서는 단계가 약간 다를 수 있습니다.

Requirements

참고

Zivid는 .NET framework 버전 4.5.2를 사용합니다. 자세한 내용은 .NET framework version 을 참조하세요.

Instructions

Create a new project

Visual Studio를 실행한 다음 Create new project 클릭하거나 FileNewProject… 클릭합니다. Visual C#용 콘솔 앱을 선택합니다.

New C# project in Visual Studio

그런 다음 프로젝트 이름, 위치, .NET 버전을 추가합니다. 이 튜토리얼에서는 다음 파일 이름과 위치를 사용합니다.

Location

C:workZividHelloWorld

C# file name

ZividHelloWorld.cs

.NET version

.NET Framework 4.8.0

New C# project in Visual Studio

Add the main C# code

ZividHelloWorld.cs 의 코드를 다음 코드 조각으로 바꾸세요.

using System;

namespace ZividHelloWorld
{
    class ZividHelloWorld
    {
        static int Main()
        {
            try
            {
                var zivid = new Zivid.NET.Application();
                Console.WriteLine("Hello World!");
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: " + ex.Message);
                return 1;
            }
            return 0;
        }
    }
}

Add reference to Zivid .NET API

코드 샘플을 실행하려면 Zivid .NET API에 대한 참조를 추가해야 합니다. 솔루션 탐색기에서 프로젝트를 마우스 오른쪽 버튼으로 클릭한 다음 AddProject Reference…Browse 를 클릭합니다. C:Program FilesZividbin 으로 이동하여 ZividCoreNET.dll*과 *ZividVisualizationNET.dll 을 추가합니다.

Visual Studio의 .NET 참조 관리자

Select the correct platform target

프로젝트를 다시 마우스 오른쪽 버튼으로 클릭한 다음, Properties 클릭합니다. BuildGeneral 에서 Platform targetx64 로 변경합니다.

Visual Studio의 플랫폼 대상

Add post-build event command line code

같은 Build 페이지에서 Events 아래에 다음 코드 블록을 Post-build event 이벤트 명령줄에 추가합니다.

if $(ConfigurationName) == Debug GOTO Debug
if $(ConfigurationName) == Release GOTO Release
goto Error

:Debug
xcopy "$(ZIVID_INSTALL_FOLDER)\bin_debug\*.dll" "$(TargetDir)" /Y
exit /B 0

:Release
xcopy "$(ZIVID_INSTALL_FOLDER)\bin\*.dll" "$(TargetDir)" /Y
exit /B 0
:Error
echo Unsupported config
exit /B 1
Visual Studio의 플랫폼 대상

프로그램을 실행하세요

이제 모든 설정과 구성이 완료되었습니다. F5 키를 눌러 프로그램을 실행하세요.

Visual Studio에서 실행한 프로그램의 콘솔 출력 스크린샷입니다.

Zivid 및 C#에서 개발을 계속하려면 다음 페이지의 Zivid .NET API referenceBuild C# Samples using Visual Studio 튜토리얼을 확인하십시오.

Version History

SDK

Changes

2.12.0

Visual Studio 2017에 대한 지원을 종료합니다.