我必须使用Team Foundation Server 2015发布Web应用程序。
首先,我尝试使用Team Foundation Server步骤“在目标计算机中复制文件”来实现。
我将这些参数传递给我的Visual Studio构建步骤:
/p:DeployDefaultTarget=Package
/p:PackageAsSingleFile=true
/p:SkipInvalidConfigurations=true
/p:WebPublishMethod=FileSystem
/p:DeleteExistingFiles=True
/p:PackageLocation=$(build.artifactstagingdirectory)\ic-drop
但是,我只在我的ic-drop文件夹中找到DLL,而我的Web项目不在这里。
因此,我决定执行一个powershell脚本来部署我的Web应用程序(Asp MVC 4)
使用此脚本:
# Define
$msbuild = "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe"
$options = "/p:PublishProfile='Default' /p:VisualStudioVersion=14.0 /p:AspnetMergePath='C:\Program` Files` (x86)\Microsoft` SDKs\Windows\v10.0A\bin\NETFX` 4.6` Tools' /p:WebPublishMethod=FileSystem /p:DeleteExistingFiles=True"
$proj = "'C:\Users\MyUser\Documents\Visual` Studio` 2015\Projects\Web\Web\Project.Path.Web.csproj'"
# Execute
$build = $msbuild + " $proj " + $options
Invoke-Expression $build
PS:我创建了一个名为“默认”的发布配置文件
因此,我尝试执行与Visual Studio中的发布命令相同的操作:
publishing in Visual Studio 2015
要进入我的目标文件夹,这些文件:
Files deployed
但是我的Powershell只是构建我的项目,然后在我的bin目录中复制输出文件(dll)。
我想我错过了一些东西,但是即使经过搜索,我还是没有找到……
最佳答案
好吧,我错过了一个论点:
/p:DeployOnBuild=true
它现在按我的预期工作! :)
关于visual-studio - 在Powershell(文件系统)中将ASP MVC 5项目发布到本地IIS(TFS),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42887031/