如何使用MSBuild为此项目文件夹中的所有文件创建MSdeploy包 [英] How to create MSdeploy Package using MSBuild for all files in this project folder

查看:293
本文介绍了如何使用MSBuild为此项目文件夹中的所有文件创建MSdeploy包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用msbuild通过命令行创建Web部署包。我一直在搜索并找到以下命令

I'm trying to create a web deploy package using msbuild through command line. I have been searching all over and found the following command

 msbuild myproject.csproj /t:package

虽然它适用于我,但它只给我提供了当我们通过Packge / Publish Web选项卡创建Web部署包时Visual Studio提供给我们的内容从下拉菜单中选择仅运行此应用程序所需的文件选项。但我希望我的Web部署包看起来与我从下拉菜单中选择此项目文件夹中的所有文件选项时所获得的完全相同。我已经浏览了这样的链接 http://sedodream.com/2010/05/01/ WebDeploymentToolMSDeployBuildPackageIncludingExtraFilesOrExcludingSpecificFiles.aspx

Though it works for me but it gives me only what visual studio gives us back when we create web deploy package through Packge/Publish Web tab with "only files needed to run this application" option selected from the drop down menu. But I want my web deploy package to look exactly the same as what I get when I select "All files in this project folder" option from the drop down menu. I have gone through links like this http://sedodream.com/2010/05/01/WebDeploymentToolMSDeployBuildPackageIncludingExtraFilesOrExcludingSpecificFiles.aspx.

但是我想知道我真的需要自定义我的.csproj文件(在那篇文章中描述的方式)因为我所有的想要,是一个命令行(显然比我上面提到的更复杂)的msbuild可以模仿此项目文件夹中的所有文件选项,填充web部署包的bin文件夹与我项目的原始bin文件夹中的所有.dll一起生成一个更全面的包。

But I wonder that do I really need to customize my .csproj file (the way its been described in that post) since all I want, is a command line (apparently more elaborate than the one I mentioned above) for msbuild that can imitate the "All files in this project folder" option that populates the "bin folder of web deploy package" with all the .dlls that are there in the original bin folder of my project and generate me a more comprehensive package.

推荐答案

In您的命令行只需将 / p:FilesToIncludeForPublish = AllFilesInProjectFolder 添加到您的msbuild调用中。当你在它时,你可能还想传递一个特定的配置来构建 / p:Configuration = Release

In your commandline simply add /p:FilesToIncludeForPublish=AllFilesInProjectFolder to your msbuild invocation. While you're at it, you may also want to pass in a specific configuration to build /p:Configuration=Release

所以:

 msbuild myproject.csproj /t:package /p:FilesToIncludeForPublish=AllFilesInProjectFolder /p:Configuration=Release

提示:其中许多设置都存储在项目文件中。在记事本中打开文件,并比较更改某些设置后所做的更改。 < propertygroup> 中的任何项目通常也可以通过命令行传递,并使用 / p:参数。

Tip: Many of these settings are stored in your project file. Open up your file in Notepad and compare the changes made when you have changed some settings. Any item that's in a <propertygroup> can usually be passed along through the commandline as well using the /p: parameter.

这篇关于如何使用MSBuild为此项目文件夹中的所有文件创建MSdeploy包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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