-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Asp.Net project with Build platform x86 #6144
Comments
@sadjadbp Not sure if it helps, but you could probably publish it: |
Having the exact same issue. @guardrex I tried publishing but for me that also crashed with a BadImageFormatException on launch like build -r x86 did. It maybe packs the x64 librarys while building the project itself for x86. |
@WolfspiritM good that it helped. But yes, now I think you are stuck with x86. Interesting enough, installing the x64 version of Windows Server Tools on our servers, I can copy the published folder there and then Web Application works fine! Either way, it seems to be VS Tooling bug or something. I'll wait for MS Person to answer to this thread. |
EDIT: Sorry everyone, this solution doesn't work. See comments further down. ORIGINAL POST:
Try this to see if Visual Studio will pick this up (you might want to delete the win7-x64 folder first to ensure it rebuilds the project. |
@Quinn-L thanks, that seems to be the fix. |
@sadjadbp are you saying that you were able to get |
@guardrex seems like |
Sorry but I can't get it to work like that.
Then did a build and ended up with a win7-x64 folder. "dotnet --info" shows: Runtime Environment: |
@WolfspiritM couple of VS restarts and now mine does not work, it seems to be caching the runtime version! So not fixed for now. |
Ok, I've restarted my machine like @sadjadbp and now it's no longer working on Visual Studio (ie. it's building against x64 again). Will need to play around more, unless there's a proper solution somewhere... |
Further research shows that x64 CLI can't build x86 apps https://github.com/dotnet/cli/issues/1485 |
@Quinn-L Seems like whichever SDK you install the first (if you have both), it will be the default. I had x64 uninstalled and x86 installed. Both projects of mine (the one I wanted to be build in x86 and the other one that is fine under x64) was build in x86. Now I installed x64 on top of x86 SDK, and still both projects are compiled in x86 mode! As you said, seem like all those settings in project.json are useless. They said, they'll move everything back to csproj to be MSBuild compatible in RC3 and forward. Maybe that'll fix our issues. |
@barrytang @abpiskunov can you take a look? Where should folks be opening VS Tooling issues? |
aspnet/Tooling#522 @piotrpMSFT I've already added in Tooling |
Tooling issue was closed by @sayedihashimi , see his comment here: aspnet/Tooling#522 |
I reopened aspnet/Tooling#522. |
I can reproduce the same problem with ASP.NET Core 1.0 and Visual Studio 2015 Update 3. The easiest way to reproduce this is to open Visual Studio and create a new ASP.NET Core Web Application (.NET Framework) project and select the "Empty" project template. Run the project without making any changes and verify that the "Hello World!" web page is shown. Note that the folder /bin/Debug/net452/win7-x64 is created. Now stop the web app, delete the Debug folder and then open project.json and add "platfrom": "x86" to the buildOptions section:
Run the application again and this time a System.AggregateException is thrown from Microsoft.AspNetCore.Server.Kestrel.dll when host.Run() is called in Program.cs.
Also note that the /bin/Debug/net452/win7-x64 is created instead of /bin/Debug/net452/win7-x86. For completeness here is what my global.json file looks like:
|
I tried almost all suggestions in this and related issues and they either don't generate any x86 binary or they result in As of now, is there any workaround to get a working My API is running well under x64 but I need to get a x86 binary one right now. |
I could get it working by running
The x86 build works just fine. |
For me, changing
to
Fixed it. I think it is because i'm running in a x64 environment. |
We are no longer supporting project.json. Please, try these out with the 1.0.1 version of the CLI that supports only MSBuild. If this is still a problem there, please, re-activate this issue. |
Here is a original thread at MVC repo, been told to open it here aspnet/Mvc#4663
I have a asp.net project that reference a native dll via Nuget package. This native DLL is only build for x86. I've changed my project.json to set buildOptions
"platform": "x86"
But when I build this asp.net project via visual studio, it creates "bin\Debug\net46\win7-x64" as oppose to "win7-x86". If I run the resulting ".exe" file it would crash.
I've tried to use "dotnet build -r win7-x86" and it would create the right folder "bin\Debug\net46\win7-x86" and then I can run the ".exe" file.
Still cannot test the application in x86 mode.
Then I've uninstalled Microsoft .NET Code 1.0.0 RC2 - SDK Preview 1 (x64) which was installed via "VS 2015 Tooling Preview" and installed the "x86" one, and everything seems to be working.
I think it is not right. I should be have the option to install x64 and x86 and then via that buildOption I should be able to tell dotnet how to compile. Just like MSBuild and ASP.Net projects where I set the build options from Project Properties.
The text was updated successfully, but these errors were encountered: