编译ASP.NET 5 Web应用程序并生成DLL文件 [英] Compiling an ASP.NET 5 Web Application and generating DLL files

查看:308
本文介绍了编译ASP.NET 5 Web应用程序并生成DLL文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个ASP.NET 5 Web应用程序.使用类库项目时,出现了一些错误.因此,我添加了类文件并编写了业务逻辑和数据访问逻辑.使用Visual Studio 发布后,Output文件夹包含实际的源代码,并且不存在已编译的DLL.如何与客户端共享已编译的文件以进行部署,而不是实际的源代码?

I created an ASP.NET 5 Web Application. While using Class Library Projects, I got some errors. So, I added class files and wrote my business logic and data access logic. After Publishing using Visual Studio, the Output folder contains the actual source code and compiled DLLs are not present. How can I share the compiled files with my client for deployment and not the actual source code?

通过在构建选项中选择在构建时生成输出,将生成一个DLL.如何通过 DNX 命令将此DLL用于托管?

By selecting the Produce outputs on build in the Build option, a DLL is generated. How can I use this DLL with DNX command for hosting?

在其中一个站点中,提到可以预编译Web应用程序.该怎么办?

In one of the sites, it was mentioned that we can Pre-compile the Web Application. How can this be done?

推荐答案

步骤1:确保在 Build 选项中选中了在生成时产生输出. (仅选中此选项,将生成DLL文件.)

Step 1: Ensure the Produce Outputs on build is checked in the Build Option. (Only if this option is checked, the DLL files will be generated.)

第2步:以发布模式构建Web应用程序.

Step 2: Build the Web Application in Release mode.

第3步:编译后的DLLs将出现在..\artifacts\bin\WebAppName\Release\dnx451中.

Step 3: The compiled DLLs will be present in: ..\artifacts\bin\WebAppName\Release\dnx451.

步骤4:可以使用 ILSpy 检查生成的DLLs.

Step 4: The generated DLLs can be checked using ILSpy.

步骤5:选择Web应用程序,然后单击发布.

Step 5: Select the Web Application and click Publish.

步骤6:转到发布的路径:..\approot\src\WebAppName并删除所有已编译为DLLsClass文件(在验证了步骤4之后).如果使用ViewModels,则不应删除这些文件,因为它们将在Views中使用(请参阅步骤8).

Step 6: Go to the published path: ..\approot\src\WebAppName and delete all the Class files which were compiled into DLLs (after verifying Step 4). If ViewModels are used, those files should not be deleted as they will be used in Views (Refer Step 8).

第7步:复制在第3步中生成的DLLs并粘贴到发布的路径:..\approot\src\WebAppName.

Step 7: Copy the DLLs generated in Step 3 and paste in the published path: ..\approot\src\WebAppName.

步骤8:将所有ViewModel文件移动到Views文件夹中.

Step 8: Move all the ViewModel files into the Views folder.

第9步:在..\approot\src\WebAppName位置打开Command Window.

步骤10:在命令窗口中键入dnx --lib "..\approot\src\WebAppName" web,然后单击Enter. (输入打开Command Window的路径.)

Step 10: Type dnx --lib "..\approot\src\WebAppName" web in the Command Window and click Enter. (Enter the path where the Command Window is opened.)

步骤11:现在,Kestrel Server已启动,您可以通过访问http://localhost:5000/

Step 11: Now, the Kestrel Server is Up and you can browse the Web Application by visiting http://localhost:5000/

注意:DNX正在已退休,以支持新的.NET核心命令限制(CLI)工具.

Note: DNX is being retired in favor of the new .NET Core Command LIne (CLI) Tools.

提示1:要从移动设备查看应用程序,请检查:

Tip 1: To view the application from a mobile device, please check: Viewing localhost website from mobile device.

这篇关于编译ASP.NET 5 Web应用程序并生成DLL文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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