简体   繁体   English

如何在Visual Studio 2012中的命令行上将ASP.NET网站或Web应用程序发布到文件系统

[英]How to publish an ASP.NET web site or web application to a file system on the command line in Visual Studio 2012

According to the answer from this SO article , command line publishing to FTP or file system is no longer supported in VS2012. 根据本文的答案,VS2012不再支持将命令行发布到FTP或文件系统。 Nevertheless, this requirement remains for my project. 但是,此要求仍然适用于我的项目。 I imagine other people and projects have the same requirement. 我想象其他人和项目有相同的要求。

What is a good way to do this? 什么是这样做的好方法?

I know that at least one answer is to use Web Deploy . 我知道至少一个答案是使用Web Deploy That's not going to work for me. 那对我不起作用。 I imagine it doesn't work for others as well. 我想这对其他人也不起作用。

My project already uses MSBuild on the command line. 我的项目已经在命令行上使用MSBuild。 It would be OK to add some kind of post-build event or extra build configuration called "CustomPublish" or some such. 添加某种类型的生成后事件或称为“ CustomPublish”的额外生成配置或类似的配置是可以的。 We could xcopy the result somewhere in the post-build event. 我们可以将结果复制到构建后事件中的某个位置。 Something like: msbuild /p:Configuration=CustomPublish 像这样的东西: msbuild /p:Configuration=CustomPublish

The problem is how to get Visual Studio to emit the final result without any "extras" like .pdb files and such. 问题是如何使Visual Studio发出最终结果而没有任何“附加”(如.pdb文件等)。

To have MSBuild not emit the debug symbols pass the following properties via the command line: 若要使MSBuild不发出调试符号,请通过命令行传递以下属性:

MSBuild.exe solution.sln /p:DebugSymbols=false /p:DebugType=None MSBuild.exe solution.sln / p:DebugSymbols = false / p:DebugType = None

You could also put these values in the new configuration you mentioned : 您也可以将这些值放在您提到的新配置中:

<DebugSymbols>false</DebugSymbols>
<DebugType>None</DebugType>

I would take a look at this MSDN link as well: Web Deployment Overview for Visual Studio and ASP.NET 我还将看一下该MSDN链接: Visual Studio和ASP.NET的Web部署概述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Visual Studio 2012-ASP.NET网站 - Visual Studio 2012 - asp.net web site 如何在Visual Studio 2012下的ASP.net Web应用程序中添加和构建打字稿文件? - How to add & build a typescript file in ASP.net web application under Visual studio 2012? 无法使用命令行发布ASP.NET网站 - Unable to publish ASP.NET web site using command line Visual Studio 2012中缺少ASP.NET Web应用程序模板 - ASP.NET Web Application template missing in Visual Studio 2012 ASP.NET web 应用程序无法在 Visual Studio 2019 中发布 - ASP.NET web application fail to publish in Visual Studio 2019 如何使用 Visual Studio 将 ASP.NET Web 应用程序 (.Net Framework) 发布到 FTP 服务器? - How to Publish ASP.NET Web Application (.Net Framework) with Visual Studio to FTP Server? 在.NET 4.5.2中使用Visual Studio 2013发布ASP.NET网站 - ASP.NET Web Site publish with Visual Studio 2013 in .NET 4.5.2 是否可以将asp.net 2012 Web应用程序发布到Azure? - Is it possible to publish an asp.net 2012 web application to azure? 生成/发布Visual Studio 2013 ASP.NET网站的单页 - Build/Publish Single Page of Visual Studio 2013 ASP.NET Web Site Windows8下的Visual Studio 2012:如何防止将ASP.NET网站文件复制到用户临时文件夹中? - Visual Studio 2012 under Windows8: how to prevent copying ASP.NET web site files into user temp folder?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM