C# System.IO.FileNotFoundException,Newtonsoft.Json.Net
我有.NET控制台应用程序,但newtonsoft库有问题。当我用VisualStudio单击开始按钮启动控制台应用程序时,并没有问题。一切都很好。但是,如果我尝试在obj/debug文件夹下运行myprogram.exe,则会出现以下错误: System.IO.FileNotFoundException:'Newtonsoft.Json,版本=9.0.0,区域性=中性,PublicKeyToken=30AD4FE6B2A6EED'文件或编译,或其依赖项之一。系统找不到指定的文件。文件名:'Newtonsoft.Json,版本=9.0.0.0,区域性=中性,PublicKeyToken=30AD4FE6B2A6EED' 位置:条形码\表单。云\表单。检查\云(字符串用户名、字符串密码)”C# System.IO.FileNotFoundException,Newtonsoft.Json.Net,c#,.net,visual-studio,json.net,C#,.net,Visual Studio,Json.net,我有.NET控制台应用程序,但newtonsoft库有问题。当我用VisualStudio单击开始按钮启动控制台应用程序时,并没有问题。一切都很好。但是,如果我尝试在obj/debug文件夹下运行myprogram.exe,则会出现以下错误: System.IO.FileNotFoundException:'Newtonsoft.Json,版本=9.0.0,区域性=中性,PublicKeyToken=30AD4FE6B2A6EED'文件或编译,或其依赖项之一。系统找不到指定的文件。文件名:'Ne
它提供了错误检查功能。如何运行myprogram.exe而不出错?提前感谢。不要从
obj\Debug
目录运行它,obj
目录基本上是临时构建人工制品。相反,从bin\Debug
目录运行它,在那里您可以找到所有依赖项(在本例中为Newtonsoft.Json.dll
)
基本上,在几乎所有情况下,您都可以忽略
obj
目录-它很少有相关性。bin
目录是包含有用结果的实际输出文件夹。显示您的代码!!
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;
}
}