2

I'm trying to switch over from Aptana to PTVS but I'm stymied by an inability to configure the build process. I'd like to add a pre-build step that runs some tests and a post-build step that runs a zip packager / deployment script -- however I'm totally unable to figure out how to add these to PTVS.

In a C# project (for example) I could right click on the project file to get a configuration page which allows editing pre and post build targets. In PVTS that configuration page doesn't exist. My efforts to tweak the .pyproj file by hand have also be unsuccessful. I added a target tag (the way you would in, eg, c#) and was told that the element 'target' did not recognize the attribute 'name' - even though that's how it's specified in all the MS build configs I've ever seen elsewhere.

Is this possible? If so, how can I set it up?

4

1 回答 1

2

从 PTVS 2.0 开始,这是不可能的。它根本不会在“构建”上运行任何目标(它在“输出”窗口中显示“正在构建”的事实实际上更像是 VS 的工件,它具有项目的强制性构建步骤)。也就是说,我们对此有一个出色的功能要求,并认识到通过 MSBuild 编写各种打包和类似任务的脚本的价值。

我们不会为即将发布的 2.1 版本做这件事,但有一些类似的东西可能会对您有所帮助 - 因为“构建”本身对于 Python 本身并没有意义,我们改为允许您在 MSBuild 中定义公开的命令在解决方案资源管理器的项目节点上的 Visual Studio UI 中;这些命令可以由任意 Python 脚本支持。看看这些,看看它是什么样子(当然,请记住,这是一个积极开发的功能,代码可能会随着我们的工作而改变):

https://pytools.codeplex.com/SourceControl/latest#Python/Product/BuildTasks/Microsoft.PythonTools.targets https://pytools.codeplex.com/SourceControl/latest#Python/Product/Django/Microsoft.PythonTools.Django .targets

(搜索<PythonCommand>

我们还没有包含这些更改的开发版本,无法轻松使用它,但我们应该很快就会推出一个。当然,您可以只获取最新的资源并构建它们。

于 2013-12-18T00:36:44.957 回答