简体   繁体   English

在没有.sln或.csproj文件的CMD中使用MsBuild

[英]Using MsBuild in CMD without .sln or .csproj files

I know how to use command prompt for executing MSBild.exe to build a project by referring to a .sln or .csproj file, for instance following code in CMD works fine and builds the project: 我知道如何使用命令提示符通过引用.sln或.csproj文件来执行MSBild.exe来构建项目,例如CMD中的以下代码可以正常工作并构建项目:

%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe C:\Projects\MySolution.sln

What I'm about to know is how to build a project by just referring the project root, since I work with a WebSite and not a WebApplication, there is no .sln file mostly (although I can create one), is there any way to build a project by code like this: 我要知道的是如何仅通过引用项目根目录来构建项目,因为我使用的是WebSite而不是WebApplication,所以大多数没有.sln文件(尽管我可以创建一个),有什么办法通过如下代码构建项目:

%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe C:\Projects\

missing MySolution.sln at the end of address? 地址末尾缺少MySolution.sln吗?

Keep in mind that visual studio builds a Website while there is no .sln file around. 请记住,Visual Studio会在没有.sln文件的情况下构建网站。

As I understand from instructions, you always need to put path with your solution.sln and the command would be like: 从说明中了解,您始终需要在solution.sln放置路径,命令如下所示:

msbuild [pathToProject]\\[solutionName].sln /t:Build /p:Configuration=Release /p:TargetFramework=v4.6.1 (the version depends on which do you need. msbuild [pathToProject]\\[solutionName].sln /t:Build /p:Configuration=Release /p:TargetFramework=v4.6.1 (版本取决于您所需的版本。

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

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