MDX + .NET Framework 2.0 + VCS Express Edition + Win XP x64
Hi,
For any CS code that uses managed D3D: everytime I try to compile an app. w/VCS Express Edition under the 64-bit edition of Win XP, the app. compiles ok but as soon as it is executed an exception message appears telling that the app. is not a real 32-bit native one.
As far as I'm concerned, after installing .NET Framework 2.0 under a x64 OS, both versions -32 bits and 64 bits- are installed on the machine. So, it seems that, by default, compilation of the code a/o execution is hooked to the 64-bit assemblies of the Framework.
Is there any workaround for this issue? (if I use .NET Framework 1.1 instead with VS 2003 the app. compiles and runs ok -because v1.1 is 32-bit, I guess).
Thanks.
This is an excellent question. As you have discovered most .Net compiler produce agnostic (MSIL) binaries. These binaries will load as 64bit processes when run on a Win64 machine.
All .Net compilers (except managed cpp) have a compile switch called platform that allows you to target your applicaiton to 1 architecture. In this case you would want to target your application to X86. To do that add "/platform:x86" to the C# compiler command line. Now your application will load on the WOW64 and everything should line up.
The reason V1.1 applications work is because V1.1 did not have the concept of 64bit. So, for appcompat reasons the OS locks all V1.x managed assemblies to run under the WOW64.
Hope that this helps.
Jeff
I am trying that for AGES. Can't add the compiler "/platform:x86" option to the Visual C# Express .... that only works with command line compiler .... Also tryed to remove the stupid "/noconfig" option from the IDE compiler but no way... And also to edit the csc.rsp file to include the "/platform" thingy with ZERO results.... I am desperated... why the hell they didn't put a simple combo box in the VC#express project options to indicate the kind of .NET assembly you wanna generate OMG!
Well, maybe I'm doing some step wrong.
First attempt, I open my app properties in VCS Express, then go to the "Debug" tag and insert "/platform:x86" (w/o the quotes) in the "Command Line Arguments" textbox, but still the exception appears -as if the parameter were disrigarded: "is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)"
Second attempt, I use that condition as a conditional compilation symbol ("Build" Tag) with no success: "Warning 2 The parameter to the compiler is invalid, '/define:/platform:x86' will be ignored. C:\WINDOWS\Microsoft.NET\Framework\v2.0.50215\Microsoft.CSharp.targets 0 0 "
Final one, I use it as a pre-build command line macro ("Build Events" tag) but the following error output: "Error 2 The command "/platform:x86" exited with code 123. C:\WINDOWS\Microsoft.NET\Framework\v2.0.50215\Microsoft.Common.targets 751 9 "
I didn't try to compile it directly from the shell since I want to use VCS Express. ?What am I doing wrong?
Pls
Jeff Schwartz tell us how we can add the "/platform:x86" using Visual C# Express ( yes we want to use the IDE, not the command line... ) to the csc.exe compilation options....
1) The "debug tag" command line is to specify ms-dos arguments, like "netstat -b -v" ... So specifying /platform:x86 wont work...
2) Conditional defines are llike /define:WIN32 and /define:DEBUG ... This is used like if you do in your .cs code #define DEBUG ... So again, wont work.
3) Build-events conditional macros are for executing ms-dos commands like
#ifdef DEBUG
xcopy c:\debug\thing.cs d:\programs
#else
xcopy c:\thing.cs d:\programs
#endif
so wont work....
Question is...how the hell I add a /platform:x86 to the csc.exe command line INSIDE the IDE ( could do without problems using ms-dos command line, but that is not an option... I wanna use an IDE, not linux-style csc.exe /q /h /e myZillionsofPointCS files... )...
Again, I dont see any "add here your manual compiler settings...." in the Visual C# Express building options.....
Exists a file called "csc.rsp" you could use that has inside the c# compiler command line options by default... BUT the stupid vc# IDE puts the /noconfig tag by default... so even if you put the /platform:x86 in the csc.rsp wont work....
And again, i wonder why MSoft didnt put a simple combo box in the VC# express build options with the options:
Asembly PE format :
1 - MSIL anycpu
2 - x86
3 - x64
and also I wonder why the hell the Managed DirectX is not compiled for .NET x64 too if the C++ is....
I see.
Ok, to sum up, the question then becomes:
?Is there a way to override -from wihtin the VCSE IDE- the "/noconfig" tag that the "express" IDE puts by default when invokes the compiler?
Thanks in advance from a prompt response.
UH
P.S.: neither do I want to compile any projects from the command shell ...
Well, I've found it ... just tested it with a few projects but it works (By the way: is there a problem with "Mesh.FromFile" operation?).
The solution is within the IDE ... It's that obvious that it's not ... if you know what I mean ...
The procedure is the following:
1) Open your CS-MDX project with VCS Express.
2) Go to the solution platforms combobox (by default, it says "Any CPU").
3) Select "Configuration Manager..." (a new dialog box will open).
4) In the project's "Platform" cell, display the combobox list and select "<New...>" (the "NNP" dialog box will open).
5) Select "x86" from the "New platform:" combobox list (you will also see "Itanium" by default and "x64").
6) Select "<Empty>" in the "Copy Settings from" combobox.
7) Check the "Create new solution platforms" checkbox.
8) Press Ok.
Then open you project's "Properties" tab and in the "Build" section configure the usual settings like "Allow Unsafe Code" (since we're dealing with MDX) and so on.
Finally, in the same section, press the "Advance..." button and select "full" in the "Debug Info:" combo box (to avoid a warning message when debugging).
I hope you understand the above-mentioned steps.
Regards,
UH
ULTRAHEAD YOU ROCK WEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
ps1 : There is a BUG in beta2 that makes CONVETED solutions not to display the "Configuration Manager" on right click/show solution properties... beware ... if you dont see the "Configuration Manager" in the solution properties then DELETE the solution/project converted from vs2k2/vs2k3 and create a vs2k5 new one, then add your project files and you will see the "Configuration Manager".
ps2 : I dont use Mesh.FromFile because I use my own 3dsmax/maya/xsi exporters... :D
ps3: Now I can compile and debug ok... but i WANT the x64 version of managed DirectX asap... Sent an e-mail to my friend Tom Miller asking for it....
This really pisses me... why the hell when I right-click over the SOLUTION the configuration manager DOESN'T APPEAR omg.... the bug in (ps1:) is killing me! Right-click over solution doesn't work and combos are BOTH grayed/disabled in the "Standard" toolbar Config Manager.... why!
I don't know. Maybe should try to reinstall VCS. Did you checked on the "Build" Menu of the main menu bar? (you can also find the "config. mgr" opetion there).
Yes I reinstalled, deleted obj/bin directories in my project, deleted program files\visual studio 8\vsharp thing, reset toolbars... nothing.... Configuration Manager, Solution Platforms and Solution Configurations are all grayed, disabled or dont appear 8(
Searching in the Internet I found a guy with my same problem:
http://www.dotnetnewsgroup.com/message/236419.aspx
http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=22699#22699
The solution given is
1) Go to Tool->Options and CHECK in the bottom of the dialog the option "Show all settings".
2) CHECK the "Show advanced build configurations" in Tools->Options->Projects and Solutions
so now all works OK, thx all.
Wow, Thanks a lot!!!
I tried and tried for hours to find a solution for this problem before i found this thread. I suggest the Configuration Manager should always be visible...to important to leave it out dont you think...now lets hope the next DirectX Update will include Managed DirectX x64...
Mario
You are a legend. Thankyou. Two years later and this thread remains: Legendary. You solved my problem in five minutes! TY UH!