MSBuild 用法

官方DOC

msbuild {PATH}
/p:DeployOnBuild=true
/p:PublishProfile={PROFILE}
/p:Username={USERNAME}
/p:Password={PASSWORD}

项目发布路径在PublishProfile内进行配置

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <!--
 3 https://go.microsoft.com/fwlink/?LinkID=208121. 
 4 -->
 5 <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 6   <PropertyGroup>
 7     <DeleteExistingFiles>True</DeleteExistingFiles>
 8     <ExcludeApp_Data>False</ExcludeApp_Data>
 9     <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
10     <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
11     <LastUsedPlatform>Any CPU</LastUsedPlatform>
12     <PublishProvider>FileSystem</PublishProvider>
13     <PublishUrl>D:publish</PublishUrl>
14     <WebPublishMethod>FileSystem</WebPublishMethod>
15     <SiteUrlToLaunchAfterPublish />
16   </PropertyGroup>
17 </Project>

此处和.net core的发布还是略有区别的

配合CI/CD能做到自动化发布

这里有个小彩蛋~✨✨
原文地址:https://www.cnblogs.com/braink-1400/p/15503855.html