TFS2008递归复制文件并不总是有效(编译vs2003)(后编译目标)
在没有SP1的情况下,我在TFS2008中复制自定义脚本中的文件时遇到一些奇怪的问题,我必须运行多次构建才能复制文件,大多数情况下,我是在第二次构建中获得文件的,让我为您提供详细信息: 这种情况发生在ASP站点和VS2003 Web解决方案上,vs2008解决方案还可以 在ASP中,我有一个虚拟的2008解决方案,构建编译这个虚拟,我重写AfterCompile,在那里我将所有文件复制到放置位置 在VS2003中,我也有一个虚拟的2008解决方案,构建首先编译虚拟,我重写后编译,使用Exec和命令编译2003解决方案,然后将文件复制到放置位置 正如您所看到的,这两种方法是相似的,我对构建本身没有问题,我的问题有两种重复性,是的,我确实签出、更新、签入,然后测试构建: 创建一个新的构建,配置脚本,第一次运行构建,bin文件夹中的一些DLL没有被复制,第二次运行构建,我得到所有文件 构建已配置并正在运行OK,将一些文件添加到项目中这主要发生在ASP站点上,运行构建,不获取此新文件,再次运行构建,我获取此新文件 以下是我的VS2003 Web解决方案构建脚本的示例TFS2008递归复制文件并不总是有效(编译vs2003)(后编译目标),tfs,visual-studio-2003,tfs-2008,Tfs,Visual Studio 2003,Tfs 2008,在没有SP1的情况下,我在TFS2008中复制自定义脚本中的文件时遇到一些奇怪的问题,我必须运行多次构建才能复制文件,大多数情况下,我是在第二次构建中获得文件的,让我为您提供详细信息: 这种情况发生在ASP站点和VS2003 Web解决方案上,vs2008解决方案还可以 在ASP中,我有一个虚拟的2008解决方案,构建编译这个虚拟,我重写AfterCompile,在那里我将所有文件复制到放置位置 在VS2003中,我也有一个虚拟的2008解决方案,构建首先编译虚拟,我重写后编译,使用Exec和命
<PropertyGroup>
<TasksPath>D:\BuildTools\</TasksPath>
<VS2003Devenv>D:\Archivos de programa\Microsoft Visual Studio .NET 2003\Common7\IDE\devenv.com</VS2003Devenv>
<VS2003VirtualFolder>CnbvPifWeb</VS2003VirtualFolder>
<VS2003Suba>Cnbv.Pif.Web</VS2003Suba>
<VS2003Project>Cnbv.Pif.Web</VS2003Project>
<VS2003WebSiteName>Sitio Web predeterminado</VS2003WebSiteName>
<VS2003Configuration>Release</VS2003Configuration>
<VS2003Branch>Desarrollo</VS2003Branch>
<VS2003RelativePath>$(SolutionRoot)\$(VS2003Branch)\$(VS2003Suba)\</VS2003RelativePath>
<VS2003SolutionPath>$(VS2003RelativePath)Cnbv.Pif.Web.sln</VS2003SolutionPath>
<VS2003LocalFolder>$(VS2003RelativePath)Sources\$(VS2003Project)\</VS2003LocalFolder>
<VS2003Output>$(BinariesRoot)\$(VS2003Project)\</VS2003Output>
<VS2003CachePath>C:\Documents and Settings\srvfoundation\VSWebCache\230-2555-CPU015\</VS2003CachePath>
<VS2003ProjectExtension>vbproj</VS2003ProjectExtension>
<VS2003CacheFile>$(VS2003CachePath)$(VS2003VirtualFolder)\_vti_pvt\$(VS2003Project).$(VS2003ProjectExtension).cache</VS2003CacheFile>
</PropertyGroup>
<Import Project="$(TasksPath)Microsoft.Sdc.Common.tasks"/>
<UsingTask TaskName="Microsoft.Sdc.Tasks.Web.WebSite.CreateVirtualDirectory" AssemblyFile="Microsoft.Sdc.Tasks.dll" />
<UsingTask TaskName="Microsoft.Sdc.Tasks.Web.WebSite.DeleteVirtualDirectory" AssemblyFile="Microsoft.Sdc.Tasks.dll" />
<ItemGroup>
<!--list of ouput files, excluding .DLL outside bin and some other files-->
<VS2003OutputFiles
Include="$(VS2003LocalFolder)**\*.*"
Exclude="$(VS2003LocalFolder)**\*.vb;$(VS2003LocalFolder)**\*.cs;$(VS2003LocalFolder)**\*.resx;$(VS2003LocalFolder)**\*.vspscc;$(VS2003LocalFolder)**\*.csproj;$(VS2003LocalFolder)**\*.vbproj;$(VS2003LocalFolder)**\*.scc;$(VS2003LocalFolder)**\*.webinfo;$(VS2003LocalFolder)**\*.snk;$(VS2003LocalFolder)**\*.dll;$(VS2003LocalFolder)**\*.exe;" />
<!-- copy dll to bin folder -->
<VS2003OutputBinFiles
Include="$(VS2003LocalFolder)bin\*.dll"/>
</ItemGroup>
<Target Name="AfterCompile">
<Message Text="Deleting cache file" />
<Microsoft.Build.Tasks.Delete
Condition="Exists('$(VS2003CacheFile)')"
Files="$(VS2003CacheFile)" />
<Message Text="Creating virtual folder $(VS2003VirtualFolder) in IIS in local path $(VS2003LocalFolder)" />
<Web.WebSite.CreateVirtualDirectory
VirtualDirectoryName="$(VS2003VirtualFolder)"
Path="$(VS2003LocalFolder)"
WebSiteName="$(VS2003WebSiteName)" />
<Message Text="Compiling $(VS2003Project) in $(VS2003Branch)" />
<Exec
Command=""$(VS2003Devenv)" "$(VS2003SolutionPath)" /build $(VS2003Configuration) /out "$(VS2003LocalFolder)$(VS2003Project).log" "/>
<Message Text="Eliminando la carpeta virtual $(VS2003VirtualFolder) en IIS" />
<Web.WebSite.DeleteVirtualDirectory
WebSiteName="$(VS2003WebSiteName)"
VirtualDirectoryName="$(VS2003VirtualFolder)" />
<MakeDir Condition="!Exists('$(VS2003Output)')" Directories="$(VS2003Output)" />
<Message Text="Copying output files @(VS2003OutputFiles)" />
<Copy
SourceFiles="@(VS2003OutputFiles)"
DestinationFiles="@(VS2003OutputFiles->'$(VS2003Output)%(RecursiveDir)%(Filename)%(Extension)')"
/>
<MakeDir Condition="!Exists('$(VS2003Output)bin\')" Directories="$(VS2003Output)bin\" />
<Message Text="Copying DLL to bin folder @(VS2003OutputBinFiles)" />
<Copy
SourceFiles="@(VS2003OutputBinFiles)"
DestinationFiles="@(VS2003OutputBinFiles->'$(VS2003Output)bin\%(Filename)%(Extension)')"
/>
<OnError ExecuteTargets="VS2003Fail" />
</Target>
<Target Name="VS2003Fail">
<Message Text="Copying log file $(VS2003RelativePath)$(VS2003Project).log" />
<Copy Condition="Exists('$(VS2003RelativePath)$(VS2003Project).log')" SourceFiles="$(VS2003RelativePath)$(VS2003Project).log" DestinationFolder="$(DropLocation)\$(BuildNumber)" />
<CallTarget ContinueOnError ="true" Targets ="CreateWorkItemWhenPartialSucceed" />
</Target>
<Target
Name="CreateWorkItemWhenPartialSucceed"
Condition=" '$(SkipWorkItemCreation)'!='true' and '$(IsDesktopBuild)'!='true' ">
<Message Text="ejecutando work" />
<PropertyGroup>
<WorkItemTitle>$(WorkItemTitle) $(BuildNumber)</WorkItemTitle>
<BuildLogText>$(BuildlogText) <ahref='file:///$(DropLocation)\$(BuildNumber)\BuildLog.txt'>$(DropLocation)\$(BuildNumber)\BuildLog.txt</a >.</BuildLogText>
<ErrorWarningLogText Condition="!Exists('$(MSBuildProjectDirectory)\ErrorsWarningsLog.txt')"></ErrorWarningLogText>
<ErrorWarningLogText Condition="Exists('$(MSBuildProjectDirectory)\ErrorsWarningsLog.txt')">$(ErrorWarningLogText) <a href='file:///$(DropLocation)\$(BuildNumber)\ErrorsWarningsLog.txt'>$(DropLocation)\$(BuildNumber)\ErrorsWarningsLog.txt</a >.</ErrorWarningLogText>
<WorkItemDescription>$(DescriptionText) %3CBR%2F%3E $(BuildlogText) %3CBR%2F%3E $(ErrorWarningLogText)</WorkItemDescription>
</PropertyGroup>
<CreateNewWorkItem
TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
BuildUri="$(BuildUri)"
BuildNumber="$(BuildNumber)"
Description="$(WorkItemDescription)"
TeamProject="$(TeamProject)"
Title="$(WorkItemTitle)"
WorkItemFieldValues="$(WorkItemFieldValues)"
WorkItemType="$(WorkItemType)"
ContinueOnError="true" />
</Target>
当我在日志中看到此消息的输出时
<Message Text="Copying DLL to bin folder @(VS2003OutputBinFiles)" />
第一次只看到一个文件的名称,第二次打印所有正确的文件,ASP站点也是如此,如果我添加一个文件,我会在第二次生成的输出中看到该文件
我希望你能帮我解决这个问题,非常感谢
胡安·扎穆迪奥(Juan Zamudio)这是在tfs论坛上由 问题是您在根级别定义了项目组。这意味着在加载项目文件时会立即对其进行评估。您希望在执行AfterCompile目标时对它们进行评估 由于您正在运行TFS 2008,因此可以通过将项目组移动到AfterCompile目标a.k.a.动态项目组来解决此问题。这将导致在执行AfterCompile目标时对项目组进行评估,并将为您提供正确的结果。不知何故,这被标记为I添加了看起来合适的标记的一部分。如果这些标签不合适,请编辑并修复。