我需要为ASP.NET mvc部署哪些文件?

时间:2022-09-05 04:12:58

I know I can just copy all of my files from my development environment into my live website directory, but then I know I'm copying several files that aren't necessary (e.g. the .sln file and .csproj files).

我知道我可以将我的所有文件从我的开发环境复制到我的实时网站目录中,但后来我知道我正在复制几个不必要的文件(例如.sln文件和.csproj文件)。

What files actually have to be copied for ASP.NET MVC web applications to run? (E.g. Do I need to copy all .CS files?)

实际上必须复制哪些文件才能运行ASP.NET MVC Web应用程序? (例如,我是否需要复制所有.CS文件?)

4 个解决方案

#1


28  

If you develop in Microsoft Visual Studio, you can use the Build > Publish option (when you're in the context of an ASP.NET MVC project) and publish it directly.

如果在Microsoft Visual Studio中进行开发,则可以使用“生成”>“发布”选项(当您处于ASP.NET MVC项目的上下文中时)并直接发布它。

If you cannot use this and have to do a copy all you need is anything that ISN'T a .cs file (views, .config files etc) and your compiled ASP.NET MVC site's .dll (ex MvcApplication1.dll). If you want to get an idea of what you need use the Build > Publish tool to a local directory and take a look at what's in there.

如果您不能使用它并且必须复制所有您需要的东西不是.cs文件(视图,.config文件等)和您编译的ASP.NET MVC站点的.dll(来自MvcApplication1.dll)。如果您想了解您需要什么,请使用Build> Publish工具到本地目录,并查看其中的内容。

You don't need solution or project files.

您不需要解决方案或项目文件。

#2


4  

Using the Build / Publish approach is the best to ensure you have the files you need. Before building though, if you don't have ASP.NET 3.5 SP1 installed on your server, make sure you go into the references in your project for the following assemblies and set the to "Copy Local" in each of their respective property pages.

使用Build / Publish方法是确保拥有所需文件的最佳方法。在构建之前,如果您的服务器上没有安装ASP.NET 3.5 SP1,请确保进入项目中的以下程序集的引用,并在每个属性页中设置为“Copy Local”。

System.Web.MVC System.Web.Routing System.Web.Abstractions

System.Web.MVC System.Web.Routing System.Web.Abstractions

This will make sure that each of these assemblies is copied to your "bin" folder on the published site.

这将确保将每个程序集复制到已发布站点上的“bin”文件夹中。

Brian

布赖恩

#3


3  

After you compile your project, you shouldn't copy all .cs files.

编译项目后,不应复制所有.cs文件。

Take a look at this link.

看看这个链接。

#4


0  

Basically everything but the views get compiled into a dll. You can use the deploy option to see what you need to deploy ;).

基本上除了视图之外的所有内容都会编译成一个dll。您可以使用deploy选项查看需要部署的内容;)。

#1


28  

If you develop in Microsoft Visual Studio, you can use the Build > Publish option (when you're in the context of an ASP.NET MVC project) and publish it directly.

如果在Microsoft Visual Studio中进行开发,则可以使用“生成”>“发布”选项(当您处于ASP.NET MVC项目的上下文中时)并直接发布它。

If you cannot use this and have to do a copy all you need is anything that ISN'T a .cs file (views, .config files etc) and your compiled ASP.NET MVC site's .dll (ex MvcApplication1.dll). If you want to get an idea of what you need use the Build > Publish tool to a local directory and take a look at what's in there.

如果您不能使用它并且必须复制所有您需要的东西不是.cs文件(视图,.config文件等)和您编译的ASP.NET MVC站点的.dll(来自MvcApplication1.dll)。如果您想了解您需要什么,请使用Build> Publish工具到本地目录,并查看其中的内容。

You don't need solution or project files.

您不需要解决方案或项目文件。

#2


4  

Using the Build / Publish approach is the best to ensure you have the files you need. Before building though, if you don't have ASP.NET 3.5 SP1 installed on your server, make sure you go into the references in your project for the following assemblies and set the to "Copy Local" in each of their respective property pages.

使用Build / Publish方法是确保拥有所需文件的最佳方法。在构建之前,如果您的服务器上没有安装ASP.NET 3.5 SP1,请确保进入项目中的以下程序集的引用,并在每个属性页中设置为“Copy Local”。

System.Web.MVC System.Web.Routing System.Web.Abstractions

System.Web.MVC System.Web.Routing System.Web.Abstractions

This will make sure that each of these assemblies is copied to your "bin" folder on the published site.

这将确保将每个程序集复制到已发布站点上的“bin”文件夹中。

Brian

布赖恩

#3


3  

After you compile your project, you shouldn't copy all .cs files.

编译项目后,不应复制所有.cs文件。

Take a look at this link.

看看这个链接。

#4


0  

Basically everything but the views get compiled into a dll. You can use the deploy option to see what you need to deploy ;).

基本上除了视图之外的所有内容都会编译成一个dll。您可以使用deploy选项查看需要部署的内容;)。