Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing output directory for asp.net project in Visual Studio

I am very new to asp.net (but not c#) and I am trying to move my output directory from \bin to ..\Build\debug. I have done this in the build properties and it builds fine and puts it into the correct output directory. However, when I try to run the application I receive the following error:

Server Error in '/' Application.

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type 'MyApp.Backend.WebApiApplication'.

Source Error:

Line 1: <%@ Application Codebehind="Global.asax.cs" Inherits="MyApp.Backend.WebApiApplication" Language="C#" %>

Source File: /global.asax Line: 1

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18045.

Is it something to do with the way Visual Studio hosts the website? Any help would be appreciated.

like image 632
Theo Avatar asked Oct 21 '22 02:10

Theo


1 Answers

It has something to do with the way asp.net looks for the dll files of your website, which it exects to be in the bin folder.

You need to make some extra configurations:

In your web.config add:

<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <probing privatePath="/Build/debug" />
  </assemblyBinding>
</runtime>

I got this from an older post: http://forums.asp.net/t/1303052.aspx. Check that out as well.

like image 81
cristi71000 Avatar answered Nov 13 '22 05:11

cristi71000