Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
189 views
in Technique[技术] by (71.8m points)

c# - Start an asp.net core project as x86 under visual studio 2015

I have a vs2015 solution containing an asp.net core project and have configured its project.json as follow :

{
  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true,
    "platform": "x86"
  },
  "runtimes": {
    "win10-x86": {}
  },
  "frameworks": {
    "net461": {}
  },
  "commands": {
    "web": "Microsoft.AspNet.Hosting --ASPNET_ENV production --server Microsoft.AspNet.Server.Kestrel --server.urls http://+:12345",
  }
  [...]
}

I am expecting the application to build and run with the platform specified in project.json ( FYI, I am running the app via vs2015 debugger on a win10/x64 box ). However, win7-x64 runtime is used instead. I can see a win7-x64 output directory and the prompt title launched indicates it too.

If I build and run directly via command line specifying the runtime, it works.

So my question is, what else do I need to configure to start the asp.net core app in x86 from vs2015 ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

There are 2 options:

  1. (global) Uninstall the 64 bit .net SDK and install the 32 bit one. Restart VS afterwards.
  2. (local) Put a new .net SDK in a different folder and add from a console that path to your PATH. Then start VS from there. It will pick the first dotnet it finds on the PATH.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...