"aspnet_compiler.exe" exited with code 1 "when enabling ASP file

I have an ASP.NET project and when building the project it shows how to build a suceessfull. But when i build the deployment project it shows build failure with error message

Error    5    "aspnet_compiler.exe" exited with code 1

      

I double-checked my project and found that when I remove the line it works fine. If I use this line, I create an error web deployment build project to build my dll. <!--#include file="admin/topstyle.asp"-->

topstyle.asp is a file that renders some common styles for the page like the image title and that's it.

Can anyone tell me how to get rid of this problem?

0


source to share


4 answers


You cannot mix ASP.NET and ASP on the same page. The ASP.NET compiler returns an error because it does not understand the ASP.NET code.



As for why the project is building in order, it is because include directives are a function of the web server, not Visual Studio or even ASP.NET. When you build Visual Studio, the include is ignored because the compiler doesn't even know what it is (it just sees it as an HTML comment), so the compiler only sees ASP.NET and HTML code ... but when the page is compiled on the fly , the web server first includes the included files and then passes the whole thing to the compiler, and then the compiler crashes when it encounters the included ASP code.

+1


source


After making changes to the vb.net code, the "aspnet_compiler.exe" error code 1 was resolved. The solution was completed successfully, but publishing failed.

The solution ran successfully, but PUBLISH FAILED with error "aspnet_compiler.exe" exited with code 1 ".

The following VB.NET code changes resolved this error:

PREVIOUS CODE:



dtRow.Item("ParentGroupName") = Session("SecondaryGroupItems").GetSecondaryGroupItem(Session("LgItems").GetLgItem(mFnTransaction.FnTransactionDetails(1).LgId).SecondaryGroupId).Name

      

NEW CODE:

Dim mmSecondaryGroupId As Integer = 0
Dim mmLgId As Integer = 0

mmLgId = mFnTransaction.FnTransactionDetails(1).LgId

mmSecondaryGroupId = DirectCast(Session("LgItems"), LgItems).GetLgItem(mmLgId).SecondaryGroupId

dtRow.Item("ParentGroupName") = DirectCast(Session("SecondaryGroupItems"), SecondaryGroupItems).GetSecondaryGroupItem(mmSecondaryGroupId).Name

      

+1


source


Does it work successfully on other pages? Also is there a Topstyle.asp page in an ASP.NET page? If not, it won't work as you cannot mix the two technologies.

The include syntax is deprecated in ASP.NET. Try using a custom control or.

If you're using ASP 2.0, look at using master pages, but this can be a big change for your application.

0


source


I found that the compiler sometimes has problems with absolute paths in include directives. Don't know if it solves this particular problem, but when possible, try using instead <!-- include virtual="~/page.asp" -->

.

0


source







All Articles