我们可以使用Kudu将C#7 Web应用程序部署到Azure吗? [英] Can we deploy a C# 7 web app to Azure using Kudu?

查看:95
本文介绍了我们可以使用Kudu将C#7 Web应用程序部署到Azure吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从Visual Studio 2017发布以来,我们可以使用C#7的新功能,我希望在Azure Web应用上进行部署时将可以使用.

Since Visual Studio 2017 is released and we can use the new C# 7 features I expected this will work when deploying on Azure Web apps.

不幸的是,在使用连续部署(kudu git deploy)时,我们看到了编译错误,因此Azure似乎还不支持新的工具链.

Unfortunately we're seeing compile errors when using continuous deployment (kudu git deploy) so it seems Azure doesn't support the new toolchain yet.

我们有什么办法可以使它现在起作用(除了直接发布程序集之外)?

Is there anything we can do to get this to work now (besides publishing the assemblies directly)?

推荐答案

,因为我们在Azure中还没有msbuild15. 如果您想通过持续集成使用c#7功能,则可能需要一些解决方法

since we don't yet have msbuild15 in Azure. if you want to use c#7 features with continuous integration, you may need some workaround

  1. 对于 dotnet核心Web解决方案,您可以在现成的 Azure中构建它.. (它使用自己的dotnet msbuild.dll)[存储库样本]
  2. 对于 asp.net Web解决方案,您需要向应用了新语言功能的项目中添加Microsoft.Net.Compilers 2.0+ nuget程序包.例如,如果解决方案中的类库使用新语法,则需要将nuget包添加到该lib项目. (因此,如果您引用此nuget包,则将导入新的c#编译器)[存储库样本]
  3. 最后对于混合解决方案(dotnet核心Web应用程序+ .NET框架类lib),您需要为.NET框架lib项目独立地运行nuget restore ,因为dotnet restore不向后兼容,它不能从旧的构建系统中删除项目.我是通过入侵我的deploy.cmd [存储库示例]
  1. for dotnet core web solution, you can build it in Azure out of the box. (it uses its own dotnet msbuild.dll) [repository sample]
  2. for asp.net web solution, you need to add Microsoft.Net.Compilers 2.0+ nuget package to the project where the new language feature is applied. For example, if a class library in the solution is using the new syntax, you need to add nuget package to that lib project. (the new c# compiler is thus imported if you refer this nuget package) [repository sample]
  3. finally for mixed solution (dotnet core web app + .NET framework class lib), you need to run nuget restore for the .NET framework lib project independently since dotnet restore is not backwards compatible, it cannot retore project from the old build system. I did this by hacking my deploy.cmd [repository sample]

这些变通办法要么尝试
模仿msbuild15(case1:dotnet msbuild.dll,case2:编译为nuget包)
或模仿nuget4.0(情况3:同时运行dotnet restorenuget3.5 restore)

these workarounds either try to
imitate msbuild15 (case1: dotnet msbuild.dll, case2: compiler as a nuget package)
or imitate nuget4.0 (case 3: run both dotnet restore and nuget3.5 restore)

我们正在为Azure构建这些工具,它们应该很快就会淘汰.您可以在 github

we are in the process of building these tools for Azure, they should be out soon. you can stay updated on github

这篇关于我们可以使用Kudu将C#7 Web应用程序部署到Azure吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆