简体   繁体   English

带有mvc和Web api项目的msbuild在单个解决方案中

[英]msbuild with mvc and web api project in a single solution

I have a solution include 2 project with 2 publish profile: 我有一个解决方案,其中包括2个项目和2个发布配置文件:

WebApplication Project: App.pubxml

WebApi Project: Api.pubxml

When I using the Team Foundation Server Build Definition, i set the MSBuild Arguments to 当我使用Team Foundation Server构建定义时,我将MSBuild参数设置为

/p:DeployOnBuild=true /p:PublishProfile=App /p:PackageLocation=$(build.artifactstagingdirectory)\Build

It will build error and alert me that it can't found app.pubxml in WebApi Project. 它将生成错误,并提醒我在WebApi Project中找不到app.pubxml。

So, My question are: 所以,我的问题是:

  1. Why msbuild will build these 2 project not only one of them? 为什么msbuild不仅会构建这两个项目,而且还会构建这两个项目?

  2. Can I separate using different publish profile in the msbuild arguments Or Can I only build only one of the project? 我可以在msbuild参数中使用不同的发布配置文件进行分隔吗?还是仅可以构建一个项目?

Publish profiles generally describe the target environment rather than the source project, for example Development, Staging and Production. 发布配置文件通常描述目标环境而不是源项目,例如开发,暂存和生产。

If you think about it in those terms it makes sense for each publish profile to have the same name, so if you rename your profiles to have the same name you shouldn't get an error. 如果以这些方式考虑,则每个发布配置文件都应使用相同的名称,因此,如果将配置文件重命名为具有相同的名称,则不会出错。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM