Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

File not found when building a Web Deployment Project

I've got a web deployment project that builds and zips a web application project. I am getting a lot of errors when I build the WDP, as follows:

Error 73 The file '/Foo.csproj/Properties/Administration/Modules/ACL.ascx' does not exist. /Foo.csproj/Properties/Administration/ACL.aspx

Error 74 Unknown server tag 'foo:ACL'. /Foo.csproj/Properties/Administration/ACL.aspx

These errors are coming from the Web Deployment Project, not the WAP. The errors always follow the same pattern, first there is an error finding the .ascx and then an associated error saying the server tag related to the previous ascx is unknown (this obviously makes sense).

There are no errors or warnings in the ascx or aspx.

The controls are registered using a <%@ Register %> tag (as opposed to being registered in the web.config)

What could be causing such a symptom?


UPDATE

The errors are coming from aspnet_compiler.exe which is run with the following command:

C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler.exe -v "/Foo.csproj" -p "C:\Projects\Foo\Foo" -u -f -d obj\Staging\TempBuildDir

and produces the following errors

Utility to precompile an ASP.NET application
Copyright (C) Microsoft Corporation. All rights reserved. /Foo.csproj/Properties/Administration/ACL.aspx(5): error ASPPARSE: The file '/Foo.csproj/Properties/Administration/Modules/ACL.ascx' does not exist.
/Foo.csproj/Properties/Administration/ACL.aspx(7): error ASPPARSE: Unknown server tag 'foo:ACL'.

in Foo.csproj ACL.aspx is declared as

<Content Include="Administration\ACL.aspx" />

<!-- Snip -->

<Compile Include="Administration\ACL.aspx.cs">
  <DependentUpon>ACL.aspx</DependentUpon>
  <SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Administration\ACL.aspx.designer.cs">
  <DependentUpon>ACL.aspx</DependentUpon>
</Compile>

and ACL.ascx as

<Content Include="Administration\Modules\ACL.ascx" />

<!-- Snip -->

<Compile Include="Administration\Modules\ACL.ascx.cs">
  <DependentUpon>ACL.ascx</DependentUpon>
  <SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Administration\Modules\ACL.ascx.designer.cs">
  <DependentUpon>ACL.ascx</DependentUpon>
</Compile>

I can't understand where the /Properties/ element of the paths is coming from in the paths in the error ! It's not in project file and it's not being fed to aspnet_compiler.exe.

The solution file and project files are identical (apart from project names) to a working solution.

like image 229
Greg B Avatar asked May 16 '11 10:05

Greg B


1 Answers

I just came across this same situation in a project at my desk, and here was my solution:

//doesn't work
<%@ Control Language="C#" 
    AutoEventWireup="true" 
    Inherits="Controls_CatalogCustomerORW"
    CodeFile="CatalogCustomerORW.ascx.cs" %>

//does work
<%@ Control Language="C#" 
    AutoEventWireup="true"
    Inherits="Controls_CatalogCustomer" 
    Codebehind="CatalogCustomer.ascx.cs" %>

The error appears to be the ever subtle CodeFile vs CodeBehind

like image 127
jcolebrand Avatar answered Sep 28 '22 23:09

jcolebrand