visual-studio - 在Powershell(文件系统)中将ASP MVC 5项目发布到本地IIS(TFS)

标签 visual-studio powershell tfs-2015 msdeploy webdeploy

我必须使用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/

相关文章:

c++ - 关于Qt的初学者问题

c# - 为什么我应该同时进行单元测试和 Web 测试(而不仅仅是 Web 测试)?

python - 安装 pysqlcipher3 windows

sharepoint - Powershell 日期到 Sharepoint 日期

azure - 使用TFS15自动将云服务发布到Azure

visual-studio-2013 - 将团队项目从 TFS 2013 迁移到 TFS 2015

node.js - TFS(内部)构建输出显示错误的字符编码

git - 在Visual Studio中 merge 后发生冲突时,某些文件已被删除

arrays - 是否可以在 PowerShell 中使 IndexOf 不区分大小写?

bash - 如何在一行中设置环境变量和执行命令(PowerShell)?