0

I've recently converted an ASP.net 2.0 Web Site Project to an ASP.net 3.5 Web Application Project and I'm still getting used to the way the files are structured.

The problem I'm running into is that when I build the corresponding Web Deployment Project it copies the obj directory. But its my understanding that the obj directory is just intermediary and doesn't provide any useful purpose for a deployed website right?

If that is correct, is there some way to configure the Web Application Project to put the intermediary obj directory elsewhere, or is there something else I should be doing to handle this properly?

thelsdj
  • 9,034
  • 10
  • 45
  • 58
  • why don't you use the publish functionality?? since it does not create obj folder at all. – Furqan Hameedi Mar 23 '11 at 07:01
  • Well, I like the Web Deployment Project approach because it allows me to have it as a build stage for certain configurations. So I can have a 'Staging' configuration that when I build it, it deploys to my IIS Staging site. Is there some reason I shouldn't use this approach? – thelsdj Mar 23 '11 at 07:06
  • there is nothing wrong with your approach, but since you converted your project from website to web application project you should manually delete this folder since VS uses this folder in in website project to control the project debugging. – Furqan Hameedi Mar 23 '11 at 07:17
  • Yeah, I've tried deleting it and also excluded it from the project, but still when I build my Web Deployment Project the obj directory gets copied to the deploy destination. – thelsdj Mar 23 '11 at 07:22

1 Answers1

2

Just add in the .csproj_deploy file the following

<Target Name="AfterBuild">
    <Message Text="------ Deleting unwanted files ------" Importance="high" />
    <CreateItem Include="$(OutputPath)obj">
        <Output TaskParameter="Include" ItemName="ObjDirPattern"/>
    </CreateItem>
    <RemoveDir Directories="@(ObjDirPattern)">
        <Output TaskParameter="RemovedDirectories" PropertyName="objdir" />
    </RemoveDir>
    <Message Text="Deleted obj directory: $(objdir)" Importance="high" />
</Target>

For more see http://msdn.microsoft.com/en-us/library/7z253716.aspx

Cristi Potlog
  • 313
  • 1
  • 16