WAP + WDP + project dependency + Team Build = no workee
- 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:
- Create an empty solution in a new Team Project.
- Create a new Class Library Project, "TestLib".
- In Class1.cs, add this line to Class1:
public static string Status = "TestLib OK"; - Create a new Web Application Project, "TestWebApp".
- Add a project reference to TestLib in TestWebApp.
- In Default.aspx, add this inside the div:
<asp:Literal runat="server" ID="LiteralTest" /> - In Default.aspx.cs, add this inside the Page_Load handler:
LiteralTest.Text = TestLib.Class1.Status; - Create a Web Deployment Project for TestWebApp.
- Build the solution locally. There should be no errors.
- Make sure everything is in source control, and check in the solution.
- Create a Team Build for the Team Project, using the defaults and whatever build server, build directory, and drop location applies to your environment.
- Run the Team Build. The WDP will fail.
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
- (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
- (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. Can you post a bit more info about the specific error you encounter without this workaround in place?
Thanks,
Aaron
- The WDP can't find the referenced project.
If you follow the directions above, you can see for yourself. 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
- Sorry, I expected that it would be consistent. I'll post the actual error text by Monday.
Thanks for looking into this! - Here are excerpts of the error:
Code SnippetProject "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'. 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
- 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? 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
- Cool. Thanks!
- 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


