Visual studio 在TFS上使用MsBuild生成部署包之前,将文件复制到源代码中
我使用TFS作为构建服务器,使用MsBuild构建解决方案并将其打包到web部署包中 MSBuild参数:Visual studio 在TFS上使用MsBuild生成部署包之前,将文件复制到源代码中,visual-studio,visual-studio-2012,tfs,msbuild,web-deployment,Visual Studio,Visual Studio 2012,Tfs,Msbuild,Web Deployment,我使用TFS作为构建服务器,使用MsBuild构建解决方案并将其打包到web部署包中 MSBuild参数:/p:CreatePackageOnPublish=true/p:DeployOnBuild=true/p:DeployTarget=Package 现在,我想在构建包之前将几个文件复制到源文件中,以便在部署到IIS时,它们将最终位于App_Data-directory中。我考虑将其作为TFS构建的一部分,并创建了一个InvokeProcess操作,该操作调用xcopy,并将文件复制到Sou
/p:CreatePackageOnPublish=true/p:DeployOnBuild=true/p:DeployTarget=Package
现在,我想在构建包之前将几个文件复制到源文件中,以便在部署到IIS时,它们将最终位于App_Data-directory中。我考虑将其作为TFS构建的一部分,并创建了一个InvokeProcess操作,该操作调用xcopy
,并将文件复制到SourcesDirectory中,但它们不会出现在构建的zip包中
我应该将文件复制到哪个目录中,以及在构建过程中复制到哪里?
有更好的方法吗?我在考虑项目文件中的后期生成事件,但是我只希望它由特定的TFS生成运行,而不是对所有生成运行。我在项目文件中使用此钩子部署特定的js版本连接文件:
<!--Hook to deploy add files -->
<PropertyGroup>
<CollectFilesFromContentDependsOn>
AddFilesToDeploy;
$(CollectFilesFromContentDependsOn);
</CollectFilesFromContentDependsOn>
</PropertyGroup>
<!--Add files to deploy -->
<Target Name="AddFilesToDeploy">
<GetAssemblyIdentity AssemblyFiles="$(TargetPath)">
<Output TaskParameter="Assemblies" ItemName="CurrentAssembly" />
</GetAssemblyIdentity>
<ItemGroup>
<JsFile Include="script\myApp.min-%(CurrentAssembly.Version).js" />
<FilesForPackagingFromProject Include="%(JsFile.Identity)">
<DestinationRelativePath>%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
</FilesForPackagingFromProject>
</ItemGroup>
</Target>
我在项目文件中使用此钩子部署特定的js版本连接文件:
<!--Hook to deploy add files -->
<PropertyGroup>
<CollectFilesFromContentDependsOn>
AddFilesToDeploy;
$(CollectFilesFromContentDependsOn);
</CollectFilesFromContentDependsOn>
</PropertyGroup>
<!--Add files to deploy -->
<Target Name="AddFilesToDeploy">
<GetAssemblyIdentity AssemblyFiles="$(TargetPath)">
<Output TaskParameter="Assemblies" ItemName="CurrentAssembly" />
</GetAssemblyIdentity>
<ItemGroup>
<JsFile Include="script\myApp.min-%(CurrentAssembly.Version).js" />
<FilesForPackagingFromProject Include="%(JsFile.Identity)">
<DestinationRelativePath>%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
</FilesForPackagingFromProject>
</ItemGroup>
</Target>
谢谢,我会调查的!构建后事件对我来说很有效,但是我需要文件最终位于包zip文件中
\u PublishedWebsites\xxx\u包中。所以我的问题是,在创建zip文件之前,我是否可以将文件复制到某个地方,以便它包含复制的文件?干杯您需要找到TFS用于创建包的过程,并像我的示例中那样使用CollectFilesFromContent
CopyAllFilesToSingleFolderForPackage
钩住它。似乎您正在寻找Hanks,我将研究它!构建后事件对我来说很有效,但是我需要文件最终位于包zip文件中\u PublishedWebsites\xxx\u包中。所以我的问题是,在创建zip文件之前,我是否可以将文件复制到某个地方,以便它包含复制的文件?干杯您需要找到TFS用来创建包的过程,并像我的示例中那样使用CollectFilesFromContent
CopyAllFilesToSingleFolderForPackage
钩住它