Search code examples
ms-access32-bitasp.net-core-1.0

asp.net core 1. how change the Target Runtime to x86


i develop an Asp core web application (.net framework). how i specify a run as 32-bit applications?

the publish wizard do not give way to change the Target Runtime, which the selected option is x64 is selected.

I installed on my machine the x86 version of .NET Core Installer.

publish wizard screenshot: enter image description here

PS Why do I need x86.

I had to run the site on a computer that installed Microsoft Access 32-bit (2003, for an old software). I also need to access data in Microsoft Access file, which requires me to use the Microsoft.Jet.OLEDB.4.0 driver.

The problem is, probably, that the app's core ASP.NET always running as 64-bit applications, is what gives me the known exception 'driver not registred' stil after set "enable 32-bit application" in IIS.

i cant install the 64-bit access driver engine, because it requires the removal of MS Access 32-bit...


Solution

  • As mentioned here you need to add the "runtimes" key to your project.json file like below image.

    Once you do this, the Target Runtime entry in Publish menu will list all of your specified runtimes. Although this is not enough to get it working since using the Publish menu and selecting x86 version will have no effect and will result in x64 binary files. (This bug may be fixed in future).

    The workaround is to navigate to your project folder where the project.json resides. Open a command prompt and type the following to have your binary in desired runtime:

    dotnet publish --runtime win7-x86

    If you get any error yet, you may need to have the corresponding runtime installed (Download form here).

    More info:

    .NET Core Project.json Runtimes

    There is also a platform key under buildOptions listing all possible targets, but yet because of some issues (like #1624) it has no effect and it seems the system ignores that.

    enter image description here