首页 文章

从Git部署到Azure网站时排除文件

提问于
浏览
3

Question:

我想从我的Azure网站部署中排除某些文件(按类型) . 这可以在不创建自定义部署文件的情况下完成吗?

Given:

  • 从本地Git存储库部署MVC 4 Web应用程序

  • 想要从站点部署中排除* .coffee(CoffeeScript)文件,但不能从我的Git仓库中排除

  • 搜索了Kudu维基(https://github.com/projectkudu/kudu/wiki),但没有找到答案

2 回答

  • 4

    我假设这些CoffeeScript文件列在您的csproj文件中,以便它们显示在Visual Studio中?

    您所要做的就是确保将Build Action设置为None而不是Content,并且不会部署它们 .

  • 1

    一种可行的方法是通过运行这样的批处理文件的post deployment action

    cd /d %HOME%\site\wwwroot
    for /F "tokens=*" %%i in ('dir /s /b *.coffee') do del %%i
    

    您可以先使用回声来确保它删除正确的文件

    for /F "tokens=*" %%i in ('dir /s /b *.coffee') do echo %%i >> toBeDeleted.txt
    

相关问题