我们可以使用Kudu将C#7 Web应用程序部署到Azure吗? [英] Can we deploy a C# 7 web app to Azure using Kudu?
问题描述
自从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
- 对于 dotnet核心Web解决方案,您可以在现成的 Azure中构建它.. (它使用自己的
dotnet msbuild.dll
)[存储库样本] - 对于 asp.net Web解决方案,您需要向
应用了新语言功能的项目中添加 Microsoft.Net.Compilers
2.0+ nuget程序包.例如,如果解决方案中的类库使用新语法,则需要将nuget包添加到该lib项目. (因此,如果您引用此nuget包,则将导入新的c#编译器)[存储库样本] - 最后对于混合解决方案(dotnet核心Web应用程序+ .NET框架类lib),您需要为.NET框架lib项目独立地运行
nuget restore
,因为dotnet restore
不向后兼容,它不能从旧的构建系统中删除项目.我是通过入侵我的deploy.cmd
[存储库示例]
- for dotnet core web solution, you can build it in Azure out of the box. (it uses its own
dotnet msbuild.dll
) [repository sample] - 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] - 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 sincedotnet restore
is not backwards compatible, it cannot retore project from the old build system. I did this by hacking mydeploy.cmd
[repository sample]
这些变通办法要么尝试
模仿msbuild15(case1:dotnet msbuild.dll
,case2:编译为nuget包)
或模仿nuget4.0(情况3:同时运行dotnet restore
和nuget3.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屋!