VisualStudio 2010 构建后事件刷新 chrome 选项卡?
我对 Visual Studio 2010 中的构建后事件有疑问。 我有一个 MVC3 项目,我想要一个构建后事件来刷新当前的 chrome 选项卡。这可能吗? 我拥有的是一个包含以下代码的 vb 文件:
set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.AppActivate "Google Chrome"
WScript.Sleep 150
WshShell.SendKeys "{f5}"
在 vs2010 的构建后事件命令行中,我拥有:
cscript c:\test.vbs
但这不会刷新页面,只会将焦点放在 chrome 上,但即便如此,如果我按 f5我的键盘在焦点后,镀铬根本不刷新。 我希望你能帮助我,谢谢!
i have a question about post-build events in visual studio 2010.
I have an MVC3 project and i want a post-build event that make a refresh on the current chrome tab. It's that possible?
What i have is a vb file with this code:
set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.AppActivate "Google Chrome"
WScript.Sleep 150
WshShell.SendKeys "{f5}"
And in the post-build event command line of vs2010 i have:
cscript c:\test.vbs
But this doesn't refresh the page, only put on focus the chrome, but even so, if i hit f5 on my keyboard after the focus, the chrome doesn't refresh at all.
I hope you can help me, thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以防万一 8 年后您仍在寻找解决方案。
就我而言,我想在构建解决方案后刷新我的网站,因为我的构建后事件将文件复制到我的网站文件夹。我用这个 AutoHotkey 脚本实现了它:
它最大化我的 chrome 窗口并发送 F5 来刷新屏幕。
当我安装 AutoHotkey 时,我选中了安装将脚本编译为可执行文件的工具的选项,我将其命名为 RefreshSite.exe。这是通过右键单击我的脚本并单击编译脚本来完成的。
最后,我的构建后事件是:
此解决方案并不完美,如果您的网站位于另一个选项卡中,则会刷新错误的选项卡。它可能还有待改进,但对我来说已经足够好了。
Just in case you are still looking for a solution 8 years later.
In my case I wanted to refresh my website after building my solution since my post-build event copies files to my website folder. I achieve it with this AutoHotkey script :
It maximizes my chrome window and send F5 to refresh the screen.
When I installed AutoHotkey, I checked the option to install the tool that compiles your script in an executable, which I named RefreshSite.exe. This was done by right-clicking my script and clicking on Compile Script
Finally, my post build event is :
This solution isn't perfect, if your site is in another tab, the wrong tab will get refreshed. It can probably be improved but was good enough for me.