0

在我的本地机器上,我检查了一个 Web 应用程序,然后使用 MSBuild 对其进行编译,然后使用 aspnet_compiler 对其进行预编译和部署。命令行如下所示:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>aspnet_compiler.exe -v / -p C:\<Some Dir> -u C:\<Some Target Dir> -f

这在本地测试中工作得很好,这意味着预编译的网站被复制到目标目录而不复制任何 .svn 目录。但是,在我为 CC.Net 编写了构建脚本的远程计算机上,.svn 目录确实被复制了。为 aspnet_compiler 手动运行命令行会得到相同的结果(复制到 .svn 文件夹):

D:\Program Files\Microsoft Visual Studio 10.0\VC>aspnet_compiler.exe -v / -p D:\<Some Dir> -u D:\<Some Target Dir> -f 

在这两种情况下,我都是从 x86 VS 工具提示符运行的。知道为什么会有不同的行为吗?

4

3 回答 3

1

如果您使用的是 CCNet,我建议您将其告知 SVN 导出而不是签出。这将解决这个问题。真正进行集成构建时,您的构建源中不应该有任何 VCS 杂物。

您必须直接在 CCNet 中调用 svn 命令行客户端,而不是执行 svn scm 块。

这一直让我很恼火,这就是我现在使用 TeamCity 的原因(这很好)。

一个小小的预感是,当使用 TortoiseSVN 时,它会将 .svn 文件夹创建为隐藏的,但是当 CCNet 调用 svn.exe 时,它​​不会隐藏文件夹。我认为 aspnet_compiler 对此很敏感。

于 2011-07-31T21:12:08.507 回答
0

您可以发布这样的代码,这将删除所有 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:\ProjectWorkingDirectories\YourWebsite\Source\**\*.*" Exclude="C:\ProjectWorkingDirectories\YourWebsite\Source\**\.svn\**"/>
    </ItemGroup>


    <Target Name = "build">
        <CallTarget Targets="PrecompileWeb"/>       
        <CallTarget Targets="CopyFiles"/>       
    </Target>


    <Target Name = "PrecompileWeb">
                <AspNetCompiler
                        VirtualPath = "/Source" 
                        PhysicalPath ="C:\ProjectWorkingDirectories\YourWebsite\Source"/>                     
        </Target>


    <Target Name = "CopyFiles">                
        <Copy SourceFiles="@(FilesToCopy)" DestinationFiles="@(FilesToCopy->'C:\TempProjectPublish\YourWebsite\YourWebsite\%(RecursiveDir)\%(Filename)%(Extension)')" ContinueOnError="true"/>
        </Target>

</Project>
于 2011-08-01T07:18:53.637 回答
0

感谢您的回复。事实证明,我能够只核对 svn 存储库本身并重新检查它并运行解决问题的 aspnet_compiler。

于 2011-08-02T17:44:07.477 回答