开发者

How can ASP.Net Compiler exclude .svn directories in the deploy

On my local machine I have checked out a web application and then compiled it with MSBuild, and then pre-compiled and deployed it with the aspnet_compiler. The command line looks like:

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

This works fine locally in testing, meaning the pre-compiled website gets copied to the target directory without copying any .svn directories to it. However, on a remote machine where I have scripted the build for CC.Net, the .svn directories do get copied over. Running the command line manually for the aspnet_compiler gives the same results (copies over the .svn folders):

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

In开发者_如何转开发 both instances I am running from the x86 VS tools prompt. Any idea why there is different behavior?


If you are using CCNet, I would suggest telling it to SVN export rather than check out. That will get around the issue. You shouldn't have any VCS crud in your build source when doing an integration build really.

You will have to call the svn command line client directly in CCNet rather than doing an svn scm block.

This has always annoyed the hell out of me which is why I use TeamCity now (which does this fine).

A small hunch has been that when using TortoiseSVN, it creates the .svn folders as hidden but when CCNet calls svn.exe it doesn't hide the folders. I think the aspnet_compiler is sensitive to that.


you can publish the code like this which will remove all svn files

<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>

or you can use like this which remove all svn files recursively

<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>


Thanks for the responses. It turns out that I was able to just nuke the svn repository itself and re-check it out and run the aspnet_compiler which solved the problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜