I have been working on a two player air hockey kind of game for windows RT devices using monogame, Apart from gaming logic I recently integrated sqlite for winRT in my app so that players could be able to save their scoreboard, view recent scores and share them on social networks. But with this Integration I started running into problems.
before explaining the problem Let me make you aware of my PC and target device architectures.
The machine on which I am developing and testing is Windows 8 pro with 64 bit x64 based processor.
And the target machine is Windows RT 32 bit os, ARM based Processor.
Now when I set the target platform of my app as "ANY CPU" and then try deploying my app I get an error which reads:
Error 1 The processor architecture of the project being built "Any CPU" is not supported by the referenced SDK "SQLite.WinRT, Version=3.8.2". Please consider changing the targeted processor architecture of your project (in visual studio this can be done through the Configuration Manager) to one of the architectures supported by the SDK: "x86, x64, ARM". Pong
Now I set the target platform as ARM then again I am in an error which says
Error 6 Error : DEP0700 : Registration of the app failed. Windows cannot install package da981e37-1c3c-4614-8c85-40485aa9e4a8 because the package requires architecture ARM, but this computer has architecture x64. (0x80073cf3) Pong
then I set the target to x86. This makes the game run normally on my PC but the package installation on target device fails with this option.
Now finally I am left with x64 as the target. This also runs well on my system, also the package gets easily installed on target machine. But it just shows me a black screen for long(Note that it is not a crash!).
I know I might be doing silly somewhere. But I am stuck on this from a long time.
Its a long note, But its only so that I could make you well aware with my problem.
Please provide the answer to the problem.
Your Suggestions are always appreciated :) Thanks.
When you want to Deploy or Debug in your Development machine, set the target Platform as "x86". When you want to deploy or debug in your RT device, change the target platform to "ARM".
You cannot deploy an app which targets "x86", or "x64" to an ARM device.
Also the "Microsoft C++ Runtime Package" dll will not allow you Build with the configuration of "Any CPU".
Related
I'm currently having more issues with packaging using the Windows Application Packaging Project (WAPP).
I desire to package my WPF app into an app bundle compatible with 32 and 64 bit systems. In my own app I added the WAPP and referenced it in accordance with this Microsoft Docs article along with doing the initial setup in the projects properties and making x64 and x86 configurations using the Configuration Manager for my WPF project.
Debugging the WAPP runs normally with no issues. When I move to publishing, I set it for sideloading, select the signature and choose to bundle the Release x64 and x86 configurations.
During the publish process, the x86 build runs first with no issues, but when doing the x64 part I'm met with this error:
There was a mismatch between the processor architecture of the project being built "AMD64" and the processor architecture of the reference "C:\Users\UserFolder\Documents\InstallerDemoSourceCode\WPFDemoApp\bin\x86\Debug\netcoreapp3.1\win-x86\WPFDemoApp.dll", "x86". This mismatch may cause runtime failures.
I've spent a while making new Wpf projects and downloading examples of other WPF projects using MSIX and attempted publishing which all ends with the same error which seems to indicate an issue with VS or my PC.
I even tried using the project unchanged from this helpful video, where he was able to build it exactly the way I want to, but am unable to do the same due the this error.
However, I did notice in the x64 build output that the build is using my x86 objects instead of x64. You can even see in the error that the DLL it is referencing is in the x86 folder. Is this a bug potentially?
Any leads would be invaluable
UPDATE #1:
In response to the suggestion from #JonasH I tried to publish the app in AnyCPU mode and received an alternate error instead:
There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "C:\Users\jacob\OneDrive\Documents\InstallerDemoSourceCode\WPFDemoApp\bin\x86\Debug\netcoreapp3.1\win-x86\WPFDemoApp.dll", "x86". This mismatch may cause runtime failures.
So I was able to fix this by literally re-selecting configurations in the Configuration Manager. i.e. Select the Any CPU Profile reselect all the projects build profiles as Any CPU, rinse and repeat for x64 and x86. This somehow worked?
I'm still unable to publish as Any CPU but all information surrounding publishing Desktop apps (WinForms, WPF, etc) to Any CPU suggests that you need to use x86 and x64 explicitly instead as that option only seems to work for UWP.
I'm having a problem, and found a suggestion to build for x86 only. But I'm not sure, though x86 can run on x64 computers, does that mean it will run as a UWP app as well, and be offered to x64 clients?
The docs weren't clear.
TL;DR: An x86 only UWP app will run on Windows x64 consumer systems, but won't run on Xbox One or older Windows ARM-based devices.
Generally speaking modern Windows x64 desktop PCs have the "Windows-on-Windows" layer which supports running 32-bit applications as well as 64-bit native apps for improved compatibility. That said, there are 64-bit versions of Windows that do not support running 32-bit apps like Windows Server (it's an optional feature) or Xbox One (which can only run x64 native apps). In these cases, a UWP package with only x86 would not run.
x86 and ARM has to date mostly been relevant to Windows Mobile platforms. There are some recently released Windows 10 on ARM devices entering the market that can run x86 or ARM, but not x64 applications.
x64 works on most Windows desktop PCs and Xbox One. Depending on the exact market segment you are targeting and your application type, you could go with just an x64 only architecture package--this is mostly relevant to high-end games or heavy performance applications.
Ideally you would ship your UWP app for all supported architectures including x86, x64 native, and ARM assuming you are able to actually test them all.
See Windows 64, UWP on Xbox One, and DirectX and UWP on Xbox One
an x86 build will NOT run on
1) windows rt/Windows S
2) xbox.
3) any windows mobile variant.
it will run on
1) windows for desktop either natively or under the WOW architecture. both 32 and 64 bit versions.
2) windows 10 for ARM 64 bit os (via win32 emulation layer under WOW.) any device that has this OS will work.
3) Hololens (requires x86)
4) IOT Core, depending on your device.
5) Surface Hub (whatever that is)
By now you can also compile arm64, which only runs on windows 10 for ARM.
I am developing a C# program with visual studio that makes use of the sql compact library. On the developing computer everything works like a charm but on my home computer that has an almost fresh win8 installment I get a System.BadImageFormatException: is not a valid win32 program and I have no clue why.
I have added the Microsoft.SqlServer.Compact package with nuget. this package includes the System.Data.SqlServerCe.dll.
I have also seen on my development computer in the output window of visual studio that the System.Data.SqlServerCe.dll is loaded from GAC. Since my home computer has a fersh win8 installment it does not have the System.Data.SqlServerCe.dll in its GAC but since I have added the Microsoft.SqlServer.Compact package with nuget that should not be problem right?
The problem is probably that your program or one of it's dependancies is 64 bit and you are running it on a 32-bit computer. Go to the project properties, and set the "platform target" to either "Any CPU" or "x86" if you are planning to run it on 32-bit systems.
As title suggests I am compiling C# app using VS 2012 on a 64-bit machine. I would like the program being built to run on a 32-bit machine.
Right now the only help I found online was for:
Menu>Build>Configuration>
Active Solution Platform defaulted to Any CPU, and I tried that but didn't work on 32-bit machine (unless I did something wrong)
Tried Add a new one to the Debug configuration for platform x86 with build checked
Compiled and ran the app on 32-bit machine getting error A.exe is not a valid Win32 application.
My above was similar to what was done here: Link to Stack Overflow Similar Question
UPDATE 1:
The target OS is WinXP SP3 but we dont believe it has .NET 4.5 on it. I will be testing to see if compiling earlier ver of the app in .NET 4.0 will solve the problem and fix the problem. The problem may not be what the error message is displaying.
Setting your project to target AnyCPU should allow it to run on a 32bit machine, provided you aren't using a library which loads 64bit native code. If you have any dependencies, you'll need to make sure to use AnyCPU or 32-bit versions of those dependencies, as well. Also, make sure you have the proper .NET Framework installed on the 32bit machine (.NET 4.5 by default, if you're using VS 2012 with a new project).
Note that the default in VS 2012 for new projects is AnyCPU, with the Prefer 32 Bit option checked. This will cause it to always run as a 32bit application, even on your 64bit OS.
Note that, since your friend is running XP sp3, you can't use .NET 4.5. .NET 4.5 is not supported on Windows XP. You will need to change your application to target .NET 4.0, which will then work on the XP machine (if he installs the 4.0 framework).
That error is the Win32 error ERROR_BAD_EXE_FORMAT. It's generated by the loader and is what happens when you try to run a 64 bit process on a 32 bit operating system. There are other ways to see that error, but this is by far the most common reason for it to occur on a .exe file.
To compile a 32 bit process you need to target x86 in your project configuration. Another alternative would be to target AnyCPU. That will result in a 32 bit process when executed on a 32 bit OS, and a 64 bit process when executed on a 64 bit OS. It would appear that your build targets x64.
The Platform name (shown on the top of the properties, page "Build") is only a name. The same for "Active Solution Platform" in configuration editor. This is a bit confusing.
You have to make sure that the "Target platform" setting is really set to "AnyCPU" or "x86".
I had same problem. I strugle with it. and the and I found a solution.
The solution is :
Firstly choose platform target "x86". After that build your project as "release mode" not "Debug mode". finally you can run on any platform (32 bit or 64 bit).
If none of the solutions presented above helped you, then try the following:
Open the project properties and click General in the left column.
Change Platform Toolset to the one with Windows XP in it.
For example, in Visual Studio 2015 it will default be set to "Visual Studio 2015 (v140)". To be able to run on Windows XP, you have to change this to "Visual Studio 2015 - Windows XP (v140_xp)".
Now do a full rebuild, and the exe should work on Windows XP.
Okay, here's my setup.
I have a c# app working perfectly on all 32-bit Windows XP-Vista-7 machine. I already have a verisign PFX to support the ClickOnce deployment and is using Atalasoft DotTwain 8.0 as the 3rd party scanner helper.
When I publish my application, I choose "Any CPU" as the Platform target. When I try to make it run on a Windows 7 64-bit Home Premium, my application crashes after the installation.
I tried re-publishing the work on a specific x64 platform but still failed.
Any ideas on what i'm doing wrong here? thanks so much~!
Choose 'x86' and I'll bet it will work;
You most likely have an 'x86' (32-bit) reference in your project, for example DotTwain. 'Any CPU' means that the .NET framework will run it as 'x64' because you've told it anything is OK. Then it tries to load a reference, finds it's 32-bit and gives a 'BadImageFormatException' (usually).
And so, you'd need a version of DotTwain that's not been 'ngen-ed', has a CPU reference of 'Any' too, or release a separate 64-bit version where all of your references are definitely not set to 'x86' (you'd want 'any' or 'x64').
(Experience this problem all the time; have several apps out there that run on 32-bit, 64-bit, and use DotTwain and other Atalasoft components)
Hope that helps!