“Changes to 64-bit applications are not allowed” w

2019-01-22 10:46发布

I'm using Visual Studio 2008, C#. I try to use edit-and-continue (edit the code while debugging), and get this exception:

"Changes to 64-bit applications are not allowed"

Why is that? Is there a workaround?

8条回答
Emotional °昔
2楼-- · 2019-01-22 11:05
  1. when Target CPU is set to 'Any CPU', it will run as a 32bit application on a 32bit windows, and 64bit application on a 64bit windows. However visual studio does not allow 'edit-and-continue' feature for 64bit application.

  2. In order to debug 'fluently' on 64bit machine, we can either:

    a) set 'Target CPU' to 'Any CPU' but check the 'Prefer 32bit' box.

    b) or, set 'Target CPU' to 'x86'

VERY important: both option requires the 'Enable optimizations' box to be unChecked.

查看更多
三岁会撩人
3楼-- · 2019-01-22 11:06

I had the same error message in MS Visual C# Express 2010. It was funny though, because the application was definitely configured as an x86 Project!

In the end, it was the following line missing in my .csproj file:

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'MY_CONFIG|x86'">
    ...
    <PlatformTarget>x86</PlatformTarget>
    ...
</PropertyGroup>

I don't know why it was missing ... I guess MS Visual C# Express 2010 is not bugfree ;)

查看更多
beautiful°
4楼-- · 2019-01-22 11:07

Like jcopenha said there's no edit-and-continue on x64 yet. Current version of the 64bit CLR does not support it. However, there's a work around.

You can find it on Bug Babble post.

You need to compile your managed assembly with a target CPU of x86. This will cause the 32 bit CLR to be used rather than the 64 bit CLR.

For a VB Project, right click on the project and go to Properties/Compile/Advanced Compile Options/Target CPU and set it to "x86". For a C# Project, right click on the project and go to Properites/Build/Platform Target and set it to "x86".

Hope it helps.

查看更多
Anthone
5楼-- · 2019-01-22 11:10

The "Edit and Continue" feature for 64-bit code will be supported under Visual Studio 2013.

More information here.

查看更多
相关推荐>>
6楼-- · 2019-01-22 11:17

Edit and Continue is not supported on 64 bit applications at the CLR level so there is no way for Visual Studio to implement it either.

The easiest way to work around this problem is to target your application to x86 chips. This will cause it to run in Wow64 mode as a 32 bit process and hence be able to ENC. You can do this by doing the following

  1. Right click on the .EXE application and choose Properties
  2. Go to the Build Tab
  3. Change the Platform Target combo box to x86

enter image description here

查看更多
何必那么认真
7楼-- · 2019-01-22 11:25

Personally, what I actually want is stop-and-edit not edit-and-continue.

So I simply turn off Tools / Options / Debugging / Edit and Continue.

Doing so inhibits that pesky dialog box from pestering me about a missing feature I didn't want in the first place :-)

查看更多
登录 后发表回答