How To run vb.net with vbs scheduled task - visual-studio-2010

I'm trying to run a windows scheduled task to open a .vb script, but when i run the task, it just opens the .vb script and does nothing else. Is there a .vbs script that will open my .vb script visual studio and run my sub?
I have a .vbs script that will open excel and run macros, just not sure how to do it with visual studio
The sub runs fine when i do it manually in visual studio
Thanks,
Andy

It does have something to do with VB.NET. Although it took me a day to see the real question.
How to run a VB.NET .vb file from vbs.
You have to compile it. Here's an article about how to do that.
appactivate between multiple internet explorer instances
Although the sample given doesn't work 7 and later because of a name conflict. Rename sendmail to something else for 7 and later.
If a limited user you need to manually add the registry entries to hkcu\software\classes. Do this by exporting as a reg file (regasm /reg) and search and replace HKEY_CLASSES_ROOT with HKEY_CURRENT_USER\Software\Classes and merge it with regedit or reg.
Also if you put in extra brackets around statements and subs vbscript code works in VB.NET mostly.
See this for how to run vbscript code in vb.net.
http://social.msdn.microsoft.com/Forums/en-US/adcae113-4758-481a-a367-60d5d14d97d6/this-is-how-to-turn-vbs-and-js-files-into-exe-files-from-the-command-line-without-third-party-tools?forum=scripting

Related

How to add powershell script as custom action in visual studio setup project

I have written one powershell(IPConfiguration.ps1) script to change the static IP address , subnet address and for disabling the IPV6 option in the ethernet network Interface. PowerShell script working well without any issue. When launching in my machine on PowerShell command prompt.
Now I am creating setup file using visual studio 2022 setup project. and wanted to launch this IPConfiguration.ps1 PowerShell script after installation, so all IP address and others option get set automatically. I believe this can be done by providing the custom action but I am not aware how to use powershell script as custom action in visual studio setup project. Because Visual studio only allow to create custom action for exe,dll,js etc not for powershell script files. so can any one please guide me , how can I use IPConfiguration.ps1 script as custom action in Visual studio 2022 setup project?
Many thanks in advance for any lead or solution.
I tried below solutions.
Execute an script/application after installing (using VS Setup Project)
https://stackoverflow.com/questions/2414956/how-to-run-a-bat-file-during-installation#:~:text=Here%27s%20what%20you%20do%3A%201%20Create%20a%20setup,want%20to%20execute%20and%20cmd.exe%20%28C%3A%5CWindows%5CSystem32%5Ccmd.exe%29%20More%20items
Tried above solution by replacing powershell.ps1 script in-place of batch script and replacing cmd.exe with powershell.exe along with proper parameter.

How do I automate a Data Flow task in Visual Studio 2015?

I am currently using Visual Studio 2015 (Community Version) and I am trying to automate a data flow task that moves an SQL input into a Flat File output.
I have tested that the task works manually however I cannot find anywhere how to automate the process, any help would be greatly appreciated as I am very new to this, Thanks
You need to schedule a process that triggers your code/DTS. You can use SQL Server Agent, Windows Scheduler or other scheduler software.
If you are working with SSIS and your process is a DTS (I'm guessin it is because you mentioned "Data Flow Task"), then you can execute it using the command line with the dtexec program.
If you are using C#, Visual Basic or another programming language in Visual Studio, make sure to compile it as a Console Application so it generates an .exe file.
Finally schedule your program execution (either dtexec or the call to the .exe) in your scheduler software, with a custom timing (for example everyday at 7am, just weekends, etc.). Make sure to monitor the results afterwards!

Best way of automating a Visual studio build on Windows

I need to build a c++ program in Visual Studio on Windows every 24 hours (I belive this is called a kron job?), and then send an email if it fails. I can't download any software on this machine, so I think I will have to make do with what Windows XP and visual studio has to offer.
I found a VBScript online that sends an e mail, which works fine. Now I need to automate the build.
I though about writing the thing on vbs and setting it in schedueled tasks to run once a day. I don't have any experience with VBs.
Is this a good way of solvig this? Any better ides?
Thanks!
You can use devenv.exe to build a solution or a project.
devenv.exe has several command line switches that could be used to start a build.
For example, to build a Release configuration of a solution file called myworkspace.sln you would do the following - devenv.exe myworkspace.sln /build Release.
Here is the list of command line arguments supported by devenv.exe -
http://msdn.microsoft.com/en-us/library/xee0c8y7(v=vs.80).aspx
For the recurring task to be run every 24 hours, use the Windows Task Scheduler to create a recurring task which runs the devenv.exe command line shown above.
Task scheduler can be found in the Administrative Tools menu or you can run the command taskschd.msc.

Open test results from a Visual Studio extension

I have a Visual Studio extension that runs tests in an external service and gets the results back as a .trx file. In the extension code, how do I display the Test Results window and open the result file there? Similarly as would happen if I clicked the .trx file externally.
Not loading the data into the window directly, but a more general solution is to open the file through ItemOperations:
DTE dte = (DTE)GetService(typeof(DTE));
dte.ItemOperations.OpenFile(pathToTheTrx);
This will of course work with any type of file Visual Studio identifies.
ten years later, I’m doing a very similar thing, I have figured out how to load tests into VS2022 into the test results explorer, but now I’m trying to figure out how to open a selected test directed to the file and line it’s located at.
I wonder if this is even possible, or if that kind of functionality is hidden from end users.

"Build" item in Windows Explorer's context menu of a VS solution file?

I wonder why this is not integrated by default. I'd like to have an item in Windows Explorer's file context menu of a VS solution file to build it.
Is there a tool for this? Or do I have to create this myself?
MSBuild Shell Extension have been there for years,
http://msbuildshellex.codeplex.com/
But you might also try out my new project,
http://msbuildlaunchpad.codeplex.com/releases/view/45368
It is quite easy to use.
MSBuild Launch Pad http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=msbuildlaunchpad&DownloadId=122261
It's going to be fairly high maintenance, but not impossible. Open Regedit.exe and locate the HKCR\VisualStudio.csproj.9.0 key. Add the Build verb, make it look similar to this:
[HKEY_CLASSES_ROOT\VisualStudio.csproj.9.0\shell\Build]
[HKEY_CLASSES_ROOT\VisualStudio.csproj.9.0\shell\Build\Command]
#="cmd.exe /k c:\temp\build.bat %1"
The cmd.exe /k command opens a console window so that you can read any error message from the build. The c:\temp\build.bat file ought to look similar to this:
call "c:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86
msbuild %1
You probably also want to add the Build key to HKCR\VisualStudio.Launcher.sln so you can build solutions as well. That however is a bit of a version maintenance headache.
Here is a project to do it for VS 2003 & 2005. It could easily be altered for 20080 and 2010 too i imagine.
http://www.codeproject.com/KB/winsdk/VS_BuildHere.aspx
You might be able to cook up something using MSBuild.exe along the lines of
<path_to_msbuild_executable>\MSBuild.exe /p:Configuration="<config>" %1
However, you would have to specify a configuration and then it will be hard to see all the output from the build. I'm not sure this would make all that much sense.
There is a collection of registry entries at http://www.nerdpad.com/windows/msbuild-context-menu-build-net-projectsolution-from-explorer that does this.

Resources