1

在 asp.net mvc 项目中,在项目构建之前,您看不到更改。我在托管公司有一个网站,我更改了一些 C# 代码,并在本地构建项目。如果我只发布更改的课程,我看不到更改。(当然,css和html代码也在变化,更新后发布到host)

那么,我应该每次都在项目构建后发布我的项目吗?有没有简单的方法来更新更改的类(只需将更改的类发布到主机)?网站更新步骤是什么?

谢谢...

4

2 回答 2

3

如果您习惯于将代码保存在App_Code文件夹中的旧“网站”项目,您只需更新代码 (.cs/.vb) 文件,网站就会重新编译。

但是,大多数 Web 项目(包括 ASP.NET MVC 项目)都是“Web应用程序”项目,其中所有编译的代码都在bin文件夹中。服务器上的任何代码文件实际上都是多余的,因为已编译的代码已经在程序集中(.DLL 文件)。

因此,您必须更新服务器上bin文件夹中的 .DLL 文件。例如,通过执行“发布”以确保仅将更改的文件上传到您的托管环境。

于 2013-04-04T15:05:40.890 回答
1

In a ASP MVC website, if you change server side code (c#,VB) you need to post the affected Dlls to the production server, is the only way. Tou cannot upload a c# file alone.

Only if you change client code you can post to the server the files (cshtml, js, css) without upload dlls and without recompile the App.

You can publish the Project to a local folder and upload only the necesary files.

于 2013-04-04T15:46:33.147 回答