通过Windows Power Shell发布ASP.NET核心应用程序

通过Windows Power Shell发布ASP.NET核心应用程序,asp.net,powershell,asp.net-core,Asp.net,Powershell,Asp.net Core,如何通过Windows Power Shell正确发布ASP.NET核心应用程序 Write-Host ==== START PUBLISHING APP ==== -ForegroundColor Red $msbuild = "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe" $options = "/p:DeployOnBuild=true /p:PublishProfile='FolderProfile'" $api

如何通过Windows Power Shell正确发布ASP.NET核心应用程序

Write-Host ==== START PUBLISHING APP ==== -ForegroundColor Red
$msbuild = "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe"
$options = "/p:DeployOnBuild=true /p:PublishProfile='FolderProfile'"
$apiproj = $BackEndPath + "\DCMT.WebApi.csproj"

# Publish the WebApi to Server...
$build = $msbuild + " $apiproj " + $options
Invoke-Expression $build
执行那个命令给了我一个错误

error MSB4040: No target element in the project.
我已将命令更改为如下所示,它可以正常工作!:D

# Publish the WebApi to Server...
$pathToCompile = "C:\DCMT\DCMT-INTERNS-SOURCE\DCMT-BackEnd\DCMT.WebApi\DCMT.WebApi\DCMT.WebApi.csproj"
dotnet publish $pathToCompile /p:PublishDir="C:\DCMT\DCMT-INTERNS"