Ask a questionAsk a question
 

AnswerWAP + WDP + project dependency + Team Build = no workee

  • Wednesday, June 27, 2007 5:53 PMbrianary Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    If you create a Web Deployment project for a Web Application Project that references another project in the solution, the WDP will not work with Team Build.

    Here's how:
    1. Create an empty solution in a new Team Project.
    2. Create a new Class Library Project, "TestLib".
    3. In Class1.cs, add this line to Class1:
      public static string Status = "TestLib OK";
    4. Create a new Web Application Project, "TestWebApp".
    5. Add a project reference to TestLib in TestWebApp.
    6. In Default.aspx, add this inside the div:
      <asp:Literal runat="server" ID="LiteralTest" />
    7. In Default.aspx.cs, add this inside the Page_Load handler:
      LiteralTest.Text = TestLib.Class1.Status;
    8. Create a Web Deployment Project for TestWebApp.
    9. Build the solution locally. There should be no errors.
    10. Make sure everything is in source control, and check in the solution.
    11. Create a Team Build for the Team Project, using the defaults and whatever build server, build directory, and drop location applies to your environment.
    12. Run the Team Build. The WDP will fail.
    If you go through the exact same steps, but choose a Web Site Project rather than a Web Application Project, the Web Deployment Project will build just fine.

    If you build locally, rather than with a Team Build, everything builds fine.

    If you leave out the WDP, everything builds fine (though you can't use any of the WDP features).

    If you do not have any project dependencies, everything works fine.

    Only when you try to combine WAP + WDP + project dependency + Team Build does the failure occur.

    Is this a known incompatibility, or am I missing a step somewhere?

Answers

  • Thursday, June 28, 2007 4:48 PMbrianary Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    (Soliloquy continues...)

    A co-worker has come up with a workaround to this issue. You'll need to edit the WDP (.wdproj) file.

    Replace the <SourceWebPhysicalPath> line with:
    Code Snippet

    <SourceWebPhysicalPath Condition="!Exists('..\..\Binaries\$(Configuration)\_PublishedWebsites\TestWebApp')">..\TestWebApp</SourceWebPhysicalPath>
    <SourceWebPhysicalPath Condition="Exists('..\..\Binaries\$(Configuration)\_PublishedWebsites\TestWebApp')">..\..\Binaries\$(Configuration)\_PublishedWebsites\TestWebApp</SourceWebPhysicalPath>



    Once this change is made and checked in, both local and team builds work OK.

All Replies

  • Thursday, June 28, 2007 4:48 PMbrianary Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    (Soliloquy continues...)

    A co-worker has come up with a workaround to this issue. You'll need to edit the WDP (.wdproj) file.

    Replace the <SourceWebPhysicalPath> line with:
    Code Snippet

    <SourceWebPhysicalPath Condition="!Exists('..\..\Binaries\$(Configuration)\_PublishedWebsites\TestWebApp')">..\TestWebApp</SourceWebPhysicalPath>
    <SourceWebPhysicalPath Condition="Exists('..\..\Binaries\$(Configuration)\_PublishedWebsites\TestWebApp')">..\..\Binaries\$(Configuration)\_PublishedWebsites\TestWebApp</SourceWebPhysicalPath>



    Once this change is made and checked in, both local and team builds work OK.

  • Thursday, June 28, 2007 9:13 PMAaron HallbergMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Can you post a bit more info about the specific error you encounter without this workaround in place?

     

    Thanks,

    Aaron

  • Friday, June 29, 2007 4:36 PMbrianary Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    The WDP can't find the referenced project.

    If you follow the directions above, you can see for yourself.
  • Friday, June 29, 2007 7:19 PMAaron HallbergMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I did follow the directions, and I'm running into a different issue:

     

    * For me, the issue has nothing to do with the WAP including a project reference (i.e. it repros without this).

    * The issue is not Team Build specific, but rather will occur any time the output of the WAP is redirected to something other than ~\bin.

     

    In particular, the error I am running into is the following:

     

    /WebApplication1.csproj/Default.aspx(1): error ASPPARSE: Could not load type 'WebApplication1._Default'.

     

    The fix for this issue seems to be to point the web deployment project to the location of the redirected output, as you noted in your second post in this thread.  FYI - the following asp.net forum post has some good information on this topic:  http://forums.asp.net/p/991668/1289279.aspx#1289279.  I'm planning on putting together a blog post once I track down all the issues here as well, and will include a link to it in a follow up post.

     

    Given that I cannot reproduce the error with the project reference, would you mind posting a bit more info (the actual error message, the relevant chunks of the build log, etc.)?

     

    -Aaron

     

     

     

  • Saturday, June 30, 2007 2:11 AMbrianary Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Sorry, I expected that it would be consistent. I'll post the actual error text by Monday.

    Thanks for looking into this!
  • Monday, July 02, 2007 3:29 PMbrianary Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Here are excerpts of the error:

    Code Snippet

                Project "C:\Builds\Build\TeamBuildTest\TeamBuildTest\Debug\Sources\TeamBuildTest.sln" is building "C:\Builds\Build\TeamBuildTest\TeamBuildTest\Debug\Sources\TestWebApp.csproj_deploy\TestWebApp.csproj_deploy.wdproj" (default targets):

                Target AspNetCompiler:
                    C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler.exe -v /TestWebApp.csproj -p C:\Builds\Build\TeamBuildTest\TeamBuildTest\Debug\Sources\TestWebApp -u -f -d C:\Builds\Build\TeamBuildTest\TeamBuildTest\Debug\Binaries\Debug\_PublishedWebsites\TestWebApp.csproj_deploy\
                    /TestWebApp.csproj/Default.aspx(1): error ASPPARSE: Could not load type 'TestWebApp._Default'.
                Done building target "AspNetCompiler" in project "TestWebApp.csproj_deploy.wdproj" -- FAILED.

    ...

    Build FAILED.
    /TestWebApp.csproj/Default.aspx(1): error ASPPARSE: Could not load type 'TestWebApp._Default'.




  • Monday, July 02, 2007 4:06 PMAaron HallbergMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Cool - that's the same error I got.  It doesn't have anything to do with a project reference in the WAP - the issue is that the WDP cannot find the WAP, and it will repro with or without the project reference.  The fix, as you have already noted, is to point the WDP to the compiled location of the WAP.

     

    -Aaron

  • Monday, July 02, 2007 8:35 PMbrianary Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    It only seems to occur when there is a project reference (or maybe any reference), so I guess I was only documenting the symptom.

    Is there a more elegant solution, or am I already using the recommended practice?
  • Monday, July 02, 2007 9:10 PMAaron HallbergMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    The approach you are using is exactly what I would recommend here, though you might think about modifying the specifics.  Have a look at the blog post I just put up here on this issue for an approach that should be slightly more reliable / re-usable.

     

    -Aaron

  • Monday, July 02, 2007 9:31 PMbrianary Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Cool. Thanks!
  • Tuesday, August 07, 2007 2:50 AMMichael Tokar Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi Aaron,

    I followed the solution on your blog, but it only half worked... I'm not getting issues when aspnet_merge.exe is executed (exits with return code 1). I've posted my issue on the ASP.NET forums, could you please look into it?

    http://forums.asp.net/p/1143196/1844278.aspx#1844278

    Thanks in advance!

    Michael Tokar