在我的本地机器上,我已经检查出一个web应用程序,然后用MSBuild编译它,然后用aspnet_compiler预编译并部署它。命令行如下所示:
C:Program Files (x86)Microsoft Visual Studio 10.0VC>aspnet_compiler.exe -v / -p C:<Some Dir> -u C:<Some Target Dir> -f
这在本地测试中工作得很好,这意味着预编译的网站被复制到目标目录,而不复制任何。svn目录。但是,在我为CC.Net编写构建脚本的远程机器上,.svn目录确实会被复制过来。为aspnet_compiler手动运行命令行会得到相同的结果(复制到.svn文件夹上):
D:Program FilesMicrosoft Visual Studio 10.0VC>aspnet_compiler.exe -v / -p D:<Some Dir> -u D:<Some Target Dir> -f
在这两个实例中,我都是从x86 VS tools提示符运行的。知道为什么会有不同的行为吗?
如果您使用的是CCNet,我建议将其告诉SVN导出而不是签出。这样就能绕开这个问题。在进行集成构建时,你不应该在构建源中有任何VCS crud。
您必须直接在CCNet中调用svn命令行客户端,而不是执行svn scm块。
这一直让我很恼火,这也是我现在使用TeamCity的原因。
一个小预感,当使用TortoiseSVN时,它创建。svn文件夹隐藏,但当CCNet调用svn.exe时,它不隐藏文件夹。我认为aspnet_compiler是敏感的
你可以像这样发布代码,它将删除所有SVN文件
<Project
xmlns = "http://schemas.microsoft.com/developer/msbuild/2003"
name = "AspNetPreCompile"
DefaultTargets = "PrecompileWeb">
<Target Name = "PrecompileWeb">
<AspNetCompiler
VirtualPath = "DeployTemp"
PhysicalPath = "Physical source path"
TargetPath = "Physical target path"
Force = "true"
Debug = "false"
Updateable = "true"/>
</Target>
</Project>
或者你可以这样使用,递归地删除所有SVN文件
<Project
xmlns = "http://schemas.microsoft.com/developer/msbuild/2003"
name = "AspNetPreCompile"
DefaultTargets = "build">
<ItemGroup>
<FilesToCopy Include="C:ProjectWorkingDirectoriesYourWebsiteSource***.*" Exclude="C:ProjectWorkingDirectoriesYourWebsiteSource**.svn**"/>
</ItemGroup>
<Target Name = "build">
<CallTarget Targets="PrecompileWeb"/>
<CallTarget Targets="CopyFiles"/>
</Target>
<Target Name = "PrecompileWeb">
<AspNetCompiler
VirtualPath = "/Source"
PhysicalPath ="C:ProjectWorkingDirectoriesYourWebsiteSource"/>
</Target>
<Target Name = "CopyFiles">
<Copy SourceFiles="@(FilesToCopy)" DestinationFiles="@(FilesToCopy->'C:TempProjectPublishYourWebsiteYourWebsite%(RecursiveDir)%(Filename)%(Extension)')" ContinueOnError="true"/>
</Target>
</Project>
感谢您的回复。事实证明,我能够只是核svn存储库本身,并重新检查出来,并运行aspnet_compiler解决了这个问题。