【发布时间】:2013-07-17 17:14:20
【问题描述】:
我有一个示例控制台应用程序测试 MySQL 连接。代码如下。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data;
using MySql.Data.MySqlClient;
namespace MySQLConnection
{
class Program
{
static void Main(string[] args)
{
string connStr = "server=localhost;user=root;database=world;port=3306;password=Password;";
using (MySqlConnection conn = new MySqlConnection(connStr))
{
conn.Open();
string sql = "SELECT COUNT(*) FROM Country";
MySqlCommand cmd = new MySqlCommand(sql, conn);
object result = cmd.ExecuteScalar();
if (result != null)
{
int r = Convert.ToInt32(result);
Console.WriteLine("Number of countries in the World database is: " + r);
}
}
Console.ReadLine();
}
}
}
代码运行良好。但是,当我尝试发布项目时,出现如下图所示的错误。
我正在使用面向 .NET 4 的 VS2012 Update 3。有什么想法吗?
谢谢。
更新:
使用这个答案:Could not find required file 'setup.bin' 我能够发布应用程序。
在我的情况下是这样的
- HKLM\Software\Microsoft\GenericBootstrapper\11.0\Path 不存在不。
- HKLM\Software\Wow6432Node\Microsoft\GenericBootstrapper\11.0\Path 存在并指向
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\Bootstrapper\
我从那个目录复制了Engine 目录到我的应用程序目录,然后就可以发布应用程序了。希望不需要每次都这样做。
【问题讨论】:
标签: c# mysql visual-studio-2012 .net-4.0 publish