Configuring a Sample Project
The huaweicloud-sdk-dis-net- X.X.X.zip package downloaded from SDK Download provides a sample project. You can use a development tool (such as Microsoft Visual Studio) to compile and run the sample project on a local device. You can also develop applications based on the sample project. The sample project code is available in [$path]\huaweicloud-sdk-dis-net-X.X.X\DIS .NET SDK\DIS .NET SDK.
|
Sample Project File |
Description |
|---|---|
|
demo |
Sample code file, which contains sample codes of net35 and net45. |
|
net35 |
Contains:
|
|
net45 |
Contains:
|
|
config |
Contains the dis.properties file that records the DIS parameter configurations and the version.properties file that records the version information. |
Procedure
- Decompress the huaweicloud-sdk-dis-net-X.X.X1.2.3.zip package downloaded from SDK Download to obtain the dis-sdk-.NET package and sample project.
- Start Visual Studio and choose . The New Project dialog box is displayed.
- Choose .
Figure 1 Creating a console application
- Right-click the new project and choose Properties from the shortcut menu. Change the version of Target framework to .Net Framework 3.5. In the displayed dialog box, click OK.
Figure 2 Changing the framework version.
- In Visual Studio, right-click the project and choose Open Folder in File Explorer from the shortcut menu to obtain the project path, for example, C:\Users\XXX\Documents\visual studio 2015\Projects\ConsoleApplication1\ConsoleApplication1.
- Copy the net35 file in the decompressed SDK package to the project path.
- Copy the dis.properties and version.properties files under the config directory from the decompressed SDK package to the $project path\bin\Debug directory.
- Modify the dis.properties file. For details about how to configure the values of endpoint, ak, sk, region, and projectId in this file, see Obtaining Authentication Information.
IS_DEFAULT_TRUSTED_JKS_ENABLED=false data.encrypt.enabled=false #todo endpoint=https://yourdomainname region=Provide your region ak=Provide your Access Key sk=Provide your Secret Key projectId=Provide your project Id
- Use the Program.cs file under the demo folder in the decompressed SDK package to replace the corresponding file in the $project path directory.
- In Visual Studio, right-click References under the new project and choose Add Reference from the shortcut menu.
Figure 3 Adding references
- In the Reference Manager dialog box, click Browse and select the following files in $project path\net35:
DISClient_3._5.dll, DISCommon.dll, and Newtonsoft.Json.dll
Figure 4 Adding dependency file *.dll
- Click OK.
Last Article: Preparing the Installation Environment
Next Article: Initializing a DIS SDK Client Instance
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.