Catatan

Tunjukkan catatan dari Ogos, 2020

Error - Cannot install service to Windows C#

Imej
Exception occurred while initializing the installation: System.IO.FileNotFoundException: Could not load file or assembly 'X' or one of its dependencies. The system cannot find the file specified... The Error Error ni muncul sebab ada jarak dekat nama folder tu. Solution kena pindahkan project folder ke C://. Pastikan directory name takde yang jarak. The Solution Run command prompt for VS2015 as Administrator - cd C:\Windows\Microsoft.NET\Framework\v4.0.30319 - InstallUtil.exe C:\PIS_sync\PIS_sync\bin\Debug\PIS_sync.exe Uninstall Window Service - InstallUtil.exe /u C:\PIS_sync\PIS_sync\bin\Debug\PIS_sync.exe   Rujuk ni :  Developer Command Prompt for Visual Studio Why can't I install my windows service - Specified service already exists Rujukan:  System.IO.FileNotFoundException: Could not load file or assembly 'X' or one of its dependencies when deploying the application Create services installer Here is my brief steps how to create service with installer: Run Visual

Create A Windows Service In C#

Imej
Rujukan :  https://www.c-sharpcorner.com/article/create-windows-services-in-c-sharp/

Solved: “An error occurred while signing: SignTool.exe not found”

Imej
Solution The main cause is that you are missing  ClickOnce Publishing Tools  component in your Visual Studio installation. Simply follow these steps to solve this issue: Go to “Add/Remove Programs” Find “Visual Studio”. Click “Change” Select “Click Once Publishing Tools” Click “Next” and then click “Update” Credits: http://stackoverflow.com/questions/7548342/an-error-occurred-while-signing-signtool-exe-not-found Rujukan :  https://port135.com/2017/01/19/solved-an-error-occurred-while-signing-signtool-exe-not-found/

Select a subset of childnodes by name C#

foreach ( XmlNode child in node . SelectNodes ( "property" )) { doSomethingElse () } Rujukan : https://stackoverflow.com/a/30370248

How to create a file or folder C#

 public static void DataLog(string message) {             string path = @"C:\DataLog\\data\\";             if (Directory.Exists(path)) {                 StreamWriter sw = null;                 try {                     string logFile = DateTime.Now.ToString("ddMMyyyy") + "data.txt";                     sw = new StreamWriter(@"C:\DataLog\\data\\" + logFile, true);                     sw.WriteLine(DateTime.Now.ToString() + " : " + message);                     sw.Flush();                     sw.Close();                 }                 catch (Exception ex) {                     Console.WriteLine("Failed! : Cannot write log . . .");                 }             }             else {                 DirectoryInfo di = Directory.CreateDirectory(path);                 Console.WriteLine("The directory was created successfully");             }         } Rujukan Directory.CreateDirectory Method -  https://docs.microsoft.com

C# : The name 'ConfigurationManager' does not exist in the current context

Imej
Error Display as below Adding the  System.Configuration  as reference to all the projects will solve this. Go to  Project  ->  Add Reference In the box that appears, click the  All assemblies  list tab in the left hand list. In the central list, scroll to  System.Configuration  and make sure the box is checked. Click ok to apply, and you'll now be able to access the  ConfigurationManager  class. Sumber : https://stackoverflow.com/a/52928968/10763264

Converting XML To C# Object From FTP

https://yomotherboard.com/converting-xml-to-c-object-from-ftp/ Examples of XML Serialization https://docs.microsoft.com/en-us/dotnet/standard/serialization/examples-of-xml-serialization