locked
VS2010 - Visual Studio uses the wrong aspnet_compiler to compile my Web Site RRS feed

  • Question

  • User-584854845 posted

    Hello,

    I have a Web Site (not a Web Application, i.e. no .csproj) that I have recently migrated from VS2005 to VS2010. The Web Site uses the .NET Framework 2.0 and ASPNET 2.0.

    I had no trouble running my Web Site on my local IIS 6.0 but when I deployed it to my Integration environment the Web Site suddenly tried to use DLL that were obviously for ASPNET 4.0.

    The main difference between the two environment being that on Integration the framework 2.0 therefore I concluded that Visual Studio was using the wrong version of aspnet_compiler. However if the solution is quite simple for a Web Application it is not for a Web Site who do not a project file.

    My question how to modify the behavior of Visual Studio to use the correct compiler when I compile a Web Site ? As you would have guessed I'm dealing with legacy project that cannot afford to be migrated to a Web Application so please do not suggest that.

    Thanks and best regards,

    Eric Gaspard.

    Friday, June 7, 2013 4:14 AM

All replies

  • User-1716253493 posted

    Try open solution explorer

    Right Click your site -> Property Pages -> Build

    Friday, June 7, 2013 4:54 AM
  • User-584854845 posted

    Hello,

    On the Build settings the target Framework is set accordingly to 2.0, however that does not  make Visual Studio use the correct aspnet_compiler...

    Thanks and regards,

    Eric Gaspard

    Friday, June 7, 2013 6:23 AM
  • User-166373564 posted

    Hi Eric

    how to modify the behavior of Visual Studio to use the correct compiler when I compile a Web Site ?

    The Aspnet_compiler.exe tool is installed in the Microsoft.NET Framework directory. If the computer is running multiple .NET Framework versions side-by-side, multiple versions of the tool might be installed. The following table lists the locations where the tool is installed for different versions of the .NET Framework,

    Version of .NET Framework                                                  Location of Aspnet_compiler.exe file
     
    
    .NET Framework version 2.0, version 3.0, and version 3.5 (32-bit systems)  %windir%\Microsoft.NET\Framework\v2.0.50727
     
    
    .NET Framework version 2.0, version 3.0, and version 3.5 (64-bit systems)%windir%\Microsoft.NET\Framework64\v2.0.50727
     
    
    .NET Framework version 4 (32-bit systems)                                  %windir%\Microsoft.NET\Framework\v4.0.30319
     
    
    .NET Framework version 4 (64-bit systems)                                %windir%\Microsoft.NET\Framework64\v4.0.30319
     
    

    Moreover, I think you should also check whether you update your website properly, and you can refer previous discussion about upgrading VS 2005 Web Application to VS 2010 in our asp.net forum, it can also give some tips for you,

    # Upgrading VS 2005 Web Application to VS 2010

    hope it helpful to troubleshoot this issue,

    Regards

     

    Wednesday, June 12, 2013 11:22 PM
  • User-584854845 posted

    Hello Angie,

    I have both the .NET Framework 2.0 and 4.0 installed on my development environment (x86 architecture by the way).

    My IIS is mapped directly on the sources therefore doing on-the-fly compilation with the correct aspnet_compiler. It is when I deploy using Visual Studio that the wrong aspnet_compiler is used, resulting in the pages' assembly demanding 4.0 assembly where my site should run in on 2.0.

    I inspected my solution file (since I do not have a .csproj) and found a

    TargetFrameworkMoniker = ".NETFramework,Version%3Dv2.0"

    which seems legit.

    Thanks and regards,

    Eric Gaspard

    Friday, June 14, 2013 3:11 AM
  • User465171450 posted

    Have you verified that the application pool for the website is using the 2.0 framework? Keep in mind, the web application itself has little control over which framework it is run under since it is the application pool that is set for the particular version of a framework.

    Saturday, June 15, 2013 11:17 AM
  • User-584854845 posted

    Hello,

    The Application Pools running my website is in 2.0. Besides I have no problem running the website on my local IIS, it is when I publish/deploy the website to another environment that the resulting DLLs for the pages/controls get mixed up with 4.0 DLLs references.

    If I manually compile with the correct aspnet_compiler then the website can be run just fine on said environment but when it's Visual Studio who do the job it uses the wrong aspnet_compiler.

    Thanks and regards,

    Eric Gaspard.

    Monday, June 17, 2013 2:26 AM
  • User-166373564 posted

    Hi Eric

    Besides I have no problem running the website on my local IIS, it is when I publish/deploy the website to another environment that the resulting DLLs for the pages/controls get mixed up with 4.0 DLLs references.

    As you mentioned above, I think this problem is relevant to your deployment strategies,

    In your situation, you need to deploy your application on local machine or a remote web server

     In case of local machine, you can easily store it on a local drive, but if you want to deploy it on a remote server, you should have a web site, you would need a FTP/FrontPage account, IP address of web server/FTP server etc.

     You can connect remote server by FTPing web site using FTP account and publish the web site content.

    # Deploy web application on remote server

    # ASP.NET Web Application Project Deployment Overview

    hope it helpful for you to troubleshoot,

    Regards

    Tuesday, June 18, 2013 2:38 AM
  • User-584854845 posted

    Hello Angie,

    Sorry I made a misunderstanding when I said that it ran fine on my local machine.

    On my local machine, the website on IIS 6 is mapped directly on my source code therefore it compile the pages and controls on the fly. When it comes to my integration website on another machine I use the Publish action with "fixed naming and single page assembly" resulting in a pre-compiled website on the integration machine.

    I had no trouble with this setup when I used VS 2005. It is only since I migrated to VS 2010 that when I deployed the website, it would not work. I inspected the DLLs of the pages which caused trouble and found evidence that they were compiled using aspnet_compiler for 4.0 and therefore making reference to 4.0 assembly which is not going to work since the pool is set to 2.0.

    I concluded that it was Visual Studio making the decision to use the wrong aspnet_compiler (in case of a website, not a web application) and searching how to fix that.

    Thanks and regards,

    Eric Gaspard

    Tuesday, June 18, 2013 3:02 AM