构建后事件命令行

时间:2014-08-12 15:54:14

标签: events reporting-services visual-studio-2013 command post-build

我查看了构建后事件命令的M $文档,但没有看到我需要的任何内容(http://msdn.microsoft.com/en-us/library/42x5kfw4.aspx), - >条件检查

这是我的构建后事件命令(VS2013 Ult):

copy $(TargetName)。*“$(DevEnvDir)\ PrivateAssemblies \” net stop“SQL Server Reporting Services(MSSQLSERVER)” copy $(TargetName)。*“C:\ Program Files \ Microsoft SQL Server \ MSRS11.MSSQLSERVER \ Reporting Services \ ReportServer \ bin \” net start“SQL Server Reporting Services(MSSQLSERVER)”

我希望他们像这样工作:

copy $(TargetName)。*“$(DevEnvDir)\ PrivateAssemblies \”

如果SSRS 2008 R2目的地存在那么 net stop“SQL Server Reporting Services(MSSQLSERVER 2008 R2)” copy $(TargetName)。*“C:\ Program Files \ Microsoft SQL Server \ MSRS10.MSSQLSERVER \ Reporting Services \ ReportServer \ bin \” net start“SQL Server Reporting Services(MSSQLSERVER 2008 R2)”

如果SSRS 2012目的地存在那么 net stop“SQL Server Reporting Services(MSSQLSERVER 2012)” copy $(TargetName)。*“C:\ Program Files \ Microsoft SQL Server \ MSRS11.MSSQLSERVER \ Reporting Services \ ReportServer \ bin \” net start“SQL Server Reporting Services(MSSQLSERVER 2012)”

如果SSRS 2014目的地存在那么 net stop“SQL Server Reporting Services(MSSQLSERVER 2014)” copy $(TargetName)。*“C:\ Program Files \ Microsoft SQL Server \ MSRS12.MSSQLSERVER \ Reporting Services \ ReportServer \ bin \” net start“SQL Server Reporting Services(MSSQLSERVER 2014)”

(事实上,我们仍然有几台服务器仍在运行SQL Server 2008 R2,主要是SQL Server 2012和一些SQL Server 2014.如果某些虚拟机有多个版本的SQL,那就不会太过分了。迁移目的所需的服务器。)

我尝试使用下面的内容“putz”,但我无法从M $或Google获取任何详细信息:

sc查询“SQL Server Reporting Services(MSSQLSERVER)”type = service |找到“SQL Server Reporting Services(MSSQLSERVER)”|找到“RUNNING”> nul

如果ERRORLEVEL 1(echo NOT RUNNING)ELSE(echo RUNNING)

由于 抢 PS对此以及与SSRS数据处理扩展相关的详细信息非常失望M $

1 个答案:

答案 0 :(得分:0)

我最终在Build Events,Post-build事件命令行中做了这个(猜测它可能会用DOS命令运行,这是" clunky",但我从来没有得到过回复在几个论坛上):

复制" $(TargetDir)$(TargetName)。*" " $(DevEnvDir)PrivateAssemblies \"

如果存在" c:\ Program Files \ Microsoft Visual Studio 10.0 \ Common7 \ IDE \ PrivateAssemblies" (echo Visual Studio 2010x64存在)

如果存在" c:\ Program Files \ Microsoft Visual Studio 10.0 \ Common7 \ IDE \ PrivateAssemblies" (copy" $(TargetDir)$(TargetName)。*"" c:\ Program Files \ Microsoft Visual Studio 10.0 \ Common7 \ IDE \ PrivateAssemblies")

如果存在" c:\ Program Files(x86)\ Microsoft Visual Studio 10.0 \ Common7 \ IDE \ PrivateAssemblies" (echo Visual Studio 2010x86存在)

如果存在" c:\ Program Files(x86)\ Microsoft Visual Studio 10.0 \ Common7 \ IDE \ PrivateAssemblies" (copy" $(TargetDir)$(TargetName)。*"" c:\ Program Files(x86)\ Microsoft Visual Studio 10.0 \ Common7 \ IDE \ PrivateAssemblies")

如果存在" c:\ Program Files \ Microsoft Visual Studio 11.0 \ Common7 \ IDE \ PrivateAssemblies" (echo Visual Studio 2012x64存在)

如果存在" c:\ Program Files \ Microsoft Visual Studio 11.0 \ Common7 \ IDE \ PrivateAssemblies" (copy" $(TargetDir)$(TargetName)。*"" c:\ Program Files \ Microsoft Visual Studio 11.0 \ Common7 \ IDE \ PrivateAssemblies")

如果存在" c:\ Program Files(x86)\ Microsoft Visual Studio 11.0 \ Common7 \ IDE \ PrivateAssemblies" (echo Visual Studio 2012x86存在)

如果存在" c:\ Program Files(x86)\ Microsoft Visual Studio 11.0 \ Common7 \ IDE \ PrivateAssemblies" (copy" $(TargetDir)$(TargetName)。*"" c:\ Program Files(x86)\ Microsoft Visual Studio 11.0 \ Common7 \ IDE \ PrivateAssemblies")

如果存在" c:\ Program Files \ Microsoft Visual Studio 12.0 \ Common7 \ IDE \ PrivateAssemblies" (echo Visual Studio 2013x64存在)

如果存在" c:\ Program Files \ Microsoft Visual Studio 12.0 \ Common7 \ IDE \ PrivateAssemblies" (copy" $(TargetDir)$(TargetName)。*"" c:\ Program Files \ Microsoft Visual Studio 12.0 \ Common7 \ IDE \ PrivateAssemblies")

如果存在" c:\ Program Files(x86)\ Microsoft Visual Studio 12.0 \ Common7 \ IDE \ PrivateAssemblies" (echo Visual Studio 2013x86存在)

如果存在" c:\ Program Files(x86)\ Microsoft Visual Studio 12.0 \ Common7 \ IDE \ PrivateAssemblies" (copy" $(TargetDir)$(TargetName)。*"" c:\ Program Files(x86)\ Microsoft Visual Studio 12.0 \ Common7 \ IDE \ PrivateAssemblies")

如果存在" c:\ Program Files \ Microsoft Visual Studio 13.0 \ Common7 \ IDE \ PrivateAssemblies" (echo Visual Studio 13.0-x64存在)

如果存在" c:\ Program Files \ Microsoft Visual Studio 13.0 \ Common7 \ IDE \ PrivateAssemblies" (copy" $(TargetDir)$(TargetName)。*"" c:\ Program Files \ Microsoft Visual Studio 13.0 \ Common7 \ IDE \ PrivateAssemblies")

如果存在" c:\ Program Files(x86)\ Microsoft Visual Studio 13.0 \ Common7 \ IDE \ PrivateAssemblies" (echo Visual Studio 13.0-x86存在)

如果存在" c:\ Program Files(x86)\ Microsoft Visual Studio 13.0 \ Common7 \ IDE \ PrivateAssemblies" (copy" $(TargetDir)$(TargetName)。*"" c:\ Program Files(x86)\ Microsoft Visual Studio 13.0 \ Common7 \ IDE \ PrivateAssemblies")

如果存在" c:\ Program Files \ Microsoft Visual Studio 14.0 \ Common7 \ IDE \ PrivateAssemblies" (echo Visual Studio 14.0-x64存在)

如果存在" c:\ Program Files \ Microsoft Visual Studio 14.0 \ Common7 \ IDE \ PrivateAssemblies" (copy" $(TargetDir)$(TargetName)。*"" c:\ Program Files \ Microsoft Visual Studio 14.0 \ Common7 \ IDE \ PrivateAssemblies")

如果存在" c:\ Program Files(x86)\ Microsoft Visual Studio 14.0 \ Common7 \ IDE \ PrivateAssemblies" (echo Visual Studio 14.0-x86存在)

如果存在" c:\ Program Files(x86)\ Microsoft Visual Studio 14.0 \ Common7 \ IDE \ PrivateAssemblies" (copy" $(TargetDir)$(TargetName)。*"" c:\ Program Files(x86)\ Microsoft Visual Studio 14.0 \ Common7 \ IDE \ PrivateAssemblies")

net stop" SQL Server Reporting Services(MSSQLSERVER)"

如果存在" C:\ Program Files \ Microsoft SQL Server \ MSRS10.MSSQLSERVER \ Reporting Services \ ReportServer \ bin \" (echo SQL Server 2008-MSRS10存在)

如果存在" C:\ Program Files \ Microsoft SQL Server \ MSRS10.MSSQLSERVER \ Reporting Services \ ReportServer \ bin \" (copy" $(TargetDir)$(TargetName)。*"" C:\ Program Files \ Microsoft SQL Server \ MSRS10.MSSQLSERVER \ Reporting Services \ ReportServer \ bin \")

如果存在" C:\ Program Files \ Microsoft SQL Server \ MSRS11.MSSQLSERVER \ Reporting Services \ ReportServer \ bin \" (echo SQL Server 2012-MSRS11存在)

如果存在" C:\ Program Files \ Microsoft SQL Server \ MSRS11.MSSQLSERVER \ Reporting Services \ ReportServer \ bin \" (copy" $(TargetDir)$(TargetName)。*"" C:\ Program Files \ Microsoft SQL Server \ MSRS11.MSSQLSERVER \ Reporting Services \ ReportServer \ bin \")

如果存在" C:\ Program Files \ Microsoft SQL Server \ MSRS12.MSSQLSERVER \ Reporting Services \ ReportServer \ bin \" (echo SQL Server 2014-MSRS12存在)

如果存在" C:\ Program Files \ Microsoft SQL Server \ MSRS12.MSSQLSERVER \ Reporting Services \ ReportServer \ bin \" (copy" $(TargetDir)$(TargetName)。*"" C:\ Program Files \ Microsoft SQL Server \ MSRS12.MSSQLSERVER \ Reporting Services \ ReportServer \ bin \")

如果存在" C:\ Program Files \ Microsoft SQL Server \ MSRS13.MSSQLSERVER \ Reporting Services \ ReportServer \ bin \" (echo SQL Server 201x-MSRS13存在)

如果存在" C:\ Program Files \ Microsoft SQL Server \ MSRS13.MSSQLSERVER \ Reporting Services \ ReportServer \ bin \" (copy" $(TargetDir)$(TargetName)。*"" C:\ Program Files \ Microsoft SQL Server \ MSRS13.MSSQLSERVER \ Reporting Services \ ReportServer \ bin \")

如果存在" C:\ Program Files \ Microsoft SQL Server \ MSRS14.MSSQLSERVER \ Reporting Services \ ReportServer \ bin \" (echo SQL Server 201x-MSRS14存在)

如果存在" C:\ Program Files \ Microsoft SQL Server \ MSRS14.MSSQLSERVER \ Reporting Services \ ReportServer \ bin \" (copy" $(TargetDir)$(TargetName)。*"" C:\ Program Files \ Microsoft SQL Server \ MSRS14.MSSQLSERVER \ Reporting Services \ ReportServer \ bin \")

net start" SQL Server Reporting Services(MSSQLSERVER)"

授予:

复制" $(TargetDir)$(TargetName)。*" " $(DevEnvDir)PrivateAssemblies \"

很可能是多余的(将在命令中再次发生),但是"我已经覆盖了" (即如果我在VS2013中构建SSRS DPE,在SQL Server 2012中注册它,我将在创建报告时看到VS2010中的扩展,或者需要根据(自定义)自定义报表查询设计器)选择DataSource)。

此处还有一些不错的 proccessor 特定逻辑:http://code-jedi.com/blog/post/Using-Platform-Specific-Libraries-from-a-Platform-Agnostic-Project.aspx

Rob K