I have to keep changing IIS every time I do a build
I am learning TFS 2010 from scratch and no doubt making every mistake in the book. So hopefully this is a 开发者_StackOverflowsimple question to answer. When I do a build a new directory is created on the build machine. That means I have to go to IIS and change the physical path for the website. I don't want to have to do that, so what should I be doing to stop this?
Deploy new builds to a fixed directory on the machine.
If you go in to the the source control explorer for the build you have created and located the TFSBuild.proj, check it out and edit it. Then add at the bottom
You have to replace the areas in CAPS below, this is for the debug build, so for Release change the area in the create item from Debug to Release. I used this method that I created at work for our dev and test build servers and it works like a charm.
<Target Name="AfterDropBuild">
<ItemGroup>
<FilesToDelete Include="\\NETWORK LOCATION TO WEB DIRECTORY USED BY IIS\**\*" />
</ItemGroup>
<Delete Files="@(FilesToDelete)" ContinueOnError="true" />
<Message Text="My target for deployment"/>
<CreateItem Include="$(DropLocation)\$(BuildNumber)\Debug\_PublishedWebsites\WEB APPLICATION NAME\**\*.*" >
<Output ItemName="FilesToCopy" TaskParameter="Include" />
</CreateItem>
<Copy
SourceFiles="@(FilesToCopy)"
DestinationFolder="\\NETWORK LOCATION TO WEB DIRECTORY USED BY IIS\%(RecursiveDir)"
SkipUnchangedFiles="false"
ContinueOnError="true"
OverwriteReadOnlyFiles="true"/>
</Target>
精彩评论