Asked by:
VS2015 ASP.NET website and x64

Question
-
User1104313641 posted
I am in the process of migrating my solution from running compiling in VS2013 x86 to VS2015 x64. My solution consists of class libraries and a ASP.NET website (NOT WEB APPLICATION) Most of my 3rd party assemblies are compiled for AnyCPU so they are easy but I do have a specific 3rd party assembly compiled specifically for x86 or x64. Up until before the migration I had a reference in my website to the x86 assembly and it was all ok. Now when trying to migrate to x64, I changed my IIS settings to run the pool as x64, removed the old x86 reference but when I add the x64 reference it just does not appear on the website references list (I tried this with other x64 assemblies and the result is the same). When trying to compile the site I get tons of errors that the compiler does not recognize types in the x64 assembly and of other types that are supposedly missing (site was fully compilable in x86)
reading about this online, I found suggestion to add a compiler option to set the target platform. when I added just the compilerOptions part to the web.config like this
<system.codedom> <compilers> <compiler compilerOptions="/platform:x64" /> </compilers> </system.codedom>
VS suddenly displayed the reference and site was compilable but when trying to access the site through IIS I got an error that the compiler line was missing a language attribute and then the extension was missng until I got to a this
<system.codedom> <compilers> <compiler compilerOptions="/platform:x64" language="c#;cs;csharp" extension=".cs"> </compiler> <compiler compilerOptions="/platform:x64" language="vb;vbs;visualbasic;vbscript" extension=".vb"> </compiler> </compilers> </system.codedom>
and now again the x64 assembly does not show in the references window.
I know I have the option of converting to a web application and that would solve this problem but I want to try to solve this using the website.
The issue I guess is because the VS IDE is x86 and for a web site it just tries to load the assembly as x86 for compilation (actual running of the site will be performed by IIS which is set to run x64)
Other things I have tried without success:
- Adding the x86 and x64 assemblies to the GAC. adding a reference to the x86 assembly or the x64 assembly in the website.
- setting under tools->options->Web Debugging->Use x64 IIS express
Also, note that because this is a website, changing the target platform on the solution configuration is not an option since I only have AnyCPU for the web site.
How can I make VS compile this as x64? other web applications I have that are compiled as x64 have a reference to the same x64 assembly without a problem (because their target platform is set to x64) but on a website I cannot seem to set this.
My machine is a Win10 x64 machine with IIS installed on it.
Sunday, February 12, 2017 2:12 PM
All replies
-
User-359936451 posted
Sorry to chime in hear, I have been watching this thread for the last two days and didn't want to pull it from the Unanswered queue. But I figured after 2 days I would chime in. I have yet to get anyCPU to work from VS2008 through VS 2015.
I am going to take a shot here, that you can't use both of these in a web site. You CAN in a web application....
<compiler compilerOptions="/platform:x64" language="c#;cs;csharp" extension=".cs"> </compiler> <compiler compilerOptions="/platform:x64" language="vb;vbs;visualbasic;vbscript" extension=".vb"> </compiler>
I would suggest you pick one and convert to one code base.
Or even test it. I seem to remember reading about the code issue some time ago, and have since always used web apps.
I had similar issues, migrating projects through .Net upgrades but eventually worked them all out. I still run most of my projects as x86. But all new ones as 64.
Tuesday, February 14, 2017 7:30 PM -
User1104313641 posted
Actually I am running only one code base. My web site is vb.net
the only reason I added the c# line was to maybe help the compiler read the x64 assembly I have and compile it (I know the IL does not care which language it came from but at this point I was willing to try any long shot)
I posted this question on a few different forums without a singe answer (except yours so thanks!). After hours of digging I found something similar and someone saying that MS told him that web site projects always compile in the IDE as x86.
My solution for now is to convert to Web Application. Not the solution I had in mind but I know it will work
Wednesday, February 15, 2017 5:37 AM -
User-359936451 posted
Well glad you have path. Wish I had more to offer here.
I can tell you this though, I am positive that I did read somewhere that you can have a both code bases in a web app but not a web site. I ran into that actual problem myself when using some code from Dan Clem for ASP Membership management. Not sure if that includes the other assemblies though. Sure wish I could find that link but it was awhile ago.
But maybe some of these will help if you haven't seen them already....
https://msdn.microsoft.com/en-us/library/ms366714.aspx
And this link argues in both ways, but I have been trying to look for issues surrounding assembly differences...
One mentions as long as the code is not in the App_Code folder it should work.
Wednesday, February 15, 2017 8:49 PM