Mat*_*ggs 22
右键单击您的项目,然后选择属性.
在属性中,选择构建选项卡.在平台目标下,选择x86.
按Ctrl + Shift + S保存所有文件,右键单击解决方案并选择"清除"以删除旧的二进制文件.之后的任何构建都应该是32位
小智 7
当我们由于ClickOnce限制而无法将现有代码从Any CPU更改为x86时,我就是这样做的:
创建一个32位(必须在项目属性下检查x86)'启动器'应用程序(Windows应用程序但不是表单):
static void Main(string[] args)
{
// Load the assembly
string directory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string assemblyName = Path.Combine(directory, "YourAnyCPUApplication.exe");
Assembly assembly = Assembly.LoadFile(assemblyName);
assembly.EntryPoint.Invoke(null, null);
}
Run Code Online (Sandbox Code Playgroud)
将以下代码添加到Any CPU项目中的Main方法:
if (IntPtr.Size == 4)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
// etc...
}
else
{
// Launch application in 32-bit mode
System.Diagnostics.Process.Start(Path.GetDirectoryName(Application.ExecutablePath) + @"\Your32BitApplicationLauncher.exe");
}
Run Code Online (Sandbox Code Playgroud)
我希望这有帮助 :-)
归档时间: |
|
查看次数: |
25603 次 |
最近记录: |