Ich habe .NET-Konsolenanwendung und es gibt ein Problem mit Newtonsoft-Bibliothek. Wenn ich die Konsolenanwendung mit Visual Studio starte, indem ich auf Start klicke, gibt es kein Problem. Alles ist gut. Wenn ich jedoch versuchen myprogram.exe unter dem obj/Debug-Ordner zu laufen, es gibt folgende Fehlermeldung:System.IO.FileNotFoundException, Newtonsoft.Json .Net
"System.IO.FileNotFoundException: 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'file or compilation, or one of its dependencies. The system can not find the specified file.File Name: 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' Location: Barcode_Form.Cloud_Form.Check_Cloud(String username, String password)"
private void button_login_Click(object sender, EventArgs e)
{
label_response.Text = "Baglaniyor...";
//Make buttons not clickable until the result of login trial
Button_status(false);
try {
if (textbox_password.Text != "" && textbox_id.Text != "")
{
//Check the cloud if the user is valid or not
if (Cloud_Form.Check_Cloud(textbox_id.Text, textbox_password.Text) == true)
{
user_id = textbox_id.Text;
user_pass = textbox_password.Text;
Network_Form network = new Network_Form();
Network_Form.network.Show();
Network_Form.network.Enabled = true;
this.Hide();
this.Enabled = false;
Xml_Write_Login();
}
}
}
catch(Exception ex)
{
this.Enabled = true;
}
label_response.Text = "";
Button_status(true);
}
public static bool Check_Cloud(string username, string password)
{
try {
string jsonstr2 = Call_Reseller_JsonStr(username, password);
JObject outp = JObject.Parse(jsonstr2);
string return_code = (string)outp["code"]; //check if it is successful or not
if (return_code.Equals("200") == true)
{
return true;
}
else {
Console.Write("false");
return false;
}
}
catch(Exception ex)
{
return false;
}
}
es gibt Fehler check_cloud Funktion. Wie kann ich myprogram.exe ausführen, ohne Fehler zu bekommen? Danke im Voraus.
Zeigen Sie uns Ihren Code !! –