首页 文章

使用VSTS的ASP.NET Core Web API的CI / CD

提问于
浏览
38

我使用Visual Studio 2017(Community Edition)创建了一个ASP.NET Core Web API应用程序 . 我可以使用Visual Studio成功发布到Azure App Service .

我现在想要使用VSTS设置CI / CD . 我使用了Visual Studio中的“配置持续交付”选项,该选项在VSTS中创建了一个项目并创建了一个构建定义 . 我必须在VSTS中基于'ASP.NET Core'模板创建一个新的构建定义,以避免Nuget恢复错误 . 现在构建解决方案并运行测试,但“发布”任务完成并发出警告 -

##[warning]No web project was found in the repository. Web projects are identified by the presence of either a web.config file or wwwroot folder in the directory.

“发布工件”任务也有类似的警告 -

##[warning]Directory 'd:\a\1\a' is empty. Nothing will be added to build artifact 'drop'.

显然,构建不会产生任何伪影 .

我是否需要将任何构建任务添加到默认的ASP.NET Core构建模板中?如何使用VSTS将我的Web API发布到Azure?

2 回答

  • 60

    作为警告消息,您的存储库似乎没有Web项目 . 因此,您应该在.NET Core发布任务中选择 Publish Web Projects 选项,并在项目选项中指定 .csproj .

    enter image description here

    您还可以找到 Publish Web Projects option 的提示消息,如下所示:

    如果为true,则任务将尝试在存储库中查找Web项目并对其运行publish命令 . 通过目录中存在web.config文件或wwwroot文件夹来识别Web项目 .

  • 0

    这可能对你有帮助..

    我也根据我的情况遇到了这个错误我用wwwroot文件夹来保存我的文件

    project.csproj

    <ItemGroup>
        <Folder Include="wwwroot\FoodItem\" />
        <Folder Include="wwwroot\Shops\" />
      </ItemGroup>
    

    在我推进到vsts后,侧面回购中没有wwwroot文件夹 . 因为我得到了这个错误然后再次推送wwwroot与子文件夹错误修复

相关问题