Wednesday, January 13, 2010

ASP.NET Web Deployment Projects and Subversion

If you are using both ASP.NET Web Deployment Projects and Subversion you might have come across the issue that the deployment project copies entire folders including the hidden Subversion folders called '.svn'.

To prevent files from being included in the deployment you can modify the project file by modifying the ItemGroup element. Here is an example that excludes '.svn' as well as the C# project file and the intermediate files in 'obj':

<ItemGroup>
   <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\.svn\**\*.*" />
   <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\*.csproj.*" />
   <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\obj\**\*.*" />
   <!-- further exclude items here -->
</ItemGroup>

Saturday, January 02, 2010

Compile error in file reference.cs

It's a bit strange but I'm observing the following: ASP.NET Web Application + Service Reference + master page = compile errors in file reference.cs Under certain circumstances the above combination doesn't seem to work in Visual Studio 2008 SP 1. If that is the case you may see compile errors like "The type name 'xxx' does not exist in the type 'yyy' ... Reference.cs ..." For example: To better understand what is going wrong let me also show the project settings: And here is the project layout:The point is that I added a master page named "Dolphin.Master". It has the prefix "Dolphin." which is also the default namespace set for the project. The default namespace in the project settings is used to generate client side code for the service reference. So if you receive a compile error, my recommendation would be to rename the master page to something different than the project's default namespace. When you do, please be aware of the following items as they may lead to follow-on issues:
  1. References to the master page will not be updated in the content pages. You will need to update them manually, e.g. using find-replace.
  2. The same applies for the rename refactoring in ReSharper (version 4.5.1288).
This post applies to Visual Studio 2008 SP1. The system had the latest patch level as of writing. I did not assess whether this issue still exists in Visual Studio 2010 as it hasn't been released yet as a production version. I'd be interested, though, if you find variations of this problem, or if you find different options for resolving it.