最終解決方案是將此添加到我的.csproj
文件的末尾。
<Target Name="Deploy" AfterTargets="Build">
<MSBuild
Projects="$(ProjectPath)"
Targets="WebPublish"
Properties="PublishProfile=LocalDeploy"
/>
</Target>
LocalDeploy
是我.pubxml
文件的$(ProjectDir)Properties/PublishProfiles
找到的名稱。
僅供參考,這裏是發佈配置文件正在使用:
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>False</LaunchSiteAfterPublish>
<PrecompileBeforePublish>True</PrecompileBeforePublish>
<EnableUpdateable>False</EnableUpdateable>
<DebugSymbols>True</DebugSymbols>
<WDPMergeOption>DonotMerge</WDPMergeOption>
<ExcludeApp_Data>False</ExcludeApp_Data>
<publishUrl>$(MSBuildThisFileDirectory)\..\..\Deploy</publishUrl>
<DeleteExistingFiles>False</DeleteExistingFiles>
</PropertyGroup>
</Project>