【发布时间】:2018-02-09 14:51:35
【问题描述】:
如果我使用 Visual Studio(使用 FileSystem)在我的网站上发布它工作正常。
现在我正尝试在 Powershell 中做同样的事情。
.\MSBuild.exe $sln /p:PublishProfile=MyTestProfile /p:PublishProvider=FileSystem /p:CreatePackageOnPublish=False /p:DeployOnBuild=False /p:VisualStudioVersion=15.0 /v:diag
以上内容基于我发布(使用诊断输出)时的输出窗口(Visual Studio)。复制并粘贴内容以避免拼写错误。
我的问题是它永远不会发布!
我现在看到来自 Powershell 的以下消息:
构建失败。
“C:\Users\me\source\repos\Test03\WebApplication2\WebApplication2.csproj”(默认目标)(1)-> C:\Users\me\source\repos\Test03\WebApplication2\WebApplication2.csproj(265,3): 错误 MSB4019: 导入的项目“C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v15.0\未找到 WebApplications\Microsoft.WebApplication.targets"。确认声明中的路径正确,并且该文件存在于磁盘上。
这个问题似乎在 SO 上有很好的记录,但是我已经安装了 VS,这不是构建服务器。这一切都在我的一台机器上完成......但是,如果我尝试到达路径 C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v15.0\WebApplications\Microsoft.WebApplication.targets 它不存在。我有C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v15.0\,但在这个文件夹中只有一个名为 FileTracker 的文件夹。
现在这让我更加困惑,因为它可以在 Visual Studio 中工作,但不能在 Powershell 中工作。
【问题讨论】:
-
仔细检查名为“MyTestProfile”的发布配置文件中的内容。如果您确实确定通过 cmd 和通过 PowerShell 提供相同的文件,那么使用例如 ProcMon 比较通过 cmd 和 PowerShell 执行完全相同的命令之间的区别。
-
@CodeCaster 感谢您的评论。你是对的,在比较输出之后,主要问题是我使用的是 Visual Studio 版本 14,但 VS 使用的是 Visual Studio 版本 15。我更新了我的帖子,因为它是一个不同的错误(但仍然阻止我发布)
标签: powershell ftp msbuild