I have a custom Code Activity that sends out a status email at the end of the build process. So far I have it working except I cant seem to get the Associated Changesets and Work Items.
Right now I am using the code below to try to get the changesets and work items but it is returning an empty List.
IList<IChangesetSummary> changesetSums = InformationNodeConverters.GetAssociatedChangesets(buildDetails);
IList<IWorkItemSummary> workItemSums = InformationNodeConverters.GetAssociatedWorkItems(buildDetails);
My CodeActivity is being run well after the AssociateChangesetsAndWorkItems activity has run and finished and the changesets and Work items show up in the build summary in Visual Studios.
The problem is, that IBuildDetail somehow does not get updated until the whole build is finished, either you use reference available in build process itself or query a new IBuildDetail separately. I have tried both when executing Powershell script near the end of the process (the behavior was the same both on agent and on controller).
The solution I have made was to use associatedChangesets variable, which contains result of AssociateChangesetsAndWorkItems activity in the default process template. This gives you an array of associated changesets.
Obtaining associated work items would then be easy, since this information should be already present. However, I have not tested this, since I did not need work items.
Related
I'm working on a project where I need a script to execute when someone hits "F5" or "F6", even if the code in the project hasn't changed.
The script is responsible for copying data from a different directory - data that may have changed.
I've noticed that this works properly as a post-build event, but only if the project is actually rebuilt. How do I get the event to trigger without requiring a clean each time?
These are the steps I followed to setup the script to run when I needed it:
Opened Project > Properties
Navigate to Custom Build Step > General
Put the script command in the "Command Line" field
Set an arbitrary output filename (this is required, if you don't have an output filename, visual studio will skip your custom build step) I chose an arbitrary filename ".filename" if I were to get fancy I'd also have the script output a log to this file
Set the "Execute After" field to "FinalizeBuildStatus" This ensures that the command will execute after the build status has been established (which happens in all circumstances when you'd hit F5 or F6, even if you haven't changed any code in the project).
I was surprised not to find these steps clearly outlined elsewhere online. Perhaps I'm bad at googling, but since I solved my own problem I find it only fitting to share in case someone else has this problem.
I have two console application projects in a single solution and they are both configured to build to a common directory. The first app calls the second app via
Process proc = new Process();
proc.StartInfo.FileName = "myprocess.exe";
I can change my startup project and debug either one of them individually just fine, but I'm unable to step into the second project from the first project. When I look in build\debug I see the .pdb files for both apps and I know the second app is running completely through its routines. I just can't step into it. I've looked at Attach to Process and Debug:Location but haven't been able to find a solution yet. I've even tried putting them in different VS solutions, but to no avail.
So I need a way to step from the first project into the second project while debugging. Any suggestions would be appreciated.
Thank you.
You can use
Debugger.Launch();
which will bring up the dialog asking if you want to attach a debugger. You won't be able to 'step in' from the existing debugging session since it's attached to a different process.
Here is in interesting one.
I have a Crystal Report that uses a single Microsoft Access 2007 table. The data in the table is updated at run time based on criteria from a list box.
If I select one entry from my list it updates the data and shows in the report. If I select and different entry is shows the data the old data. If i select that report enough times it will eventually show the new data.
The data in the access data base is updated as I checked manually
My problem is that there seems to be a delay in between the data updating and the report showing the new data.
Is there anyway to reduce this delay or get my program to wait until access has finished updating ?
Here's some ideas:
If you're mixing cr-xi with VS2010, and have no real reason to do so, then uninstall xi and install the new libraries for VS2010. I had issues mixing cr-xi with VS2010.
There's an option to save data with report. Make sure that's turned off. If it already was, turn it on, run the report, then turn it off again.
You can try rpt.Refresh(), right before crystalReportViewer1.ReportSource = rpt.
This page had some ideas, including the last one I listed.
I am trying to get an instance of the IVsBuildableProjectCfg object, but I have no clue how to get it.
I currently can get the DTE Project and/or the IVsHierarchy object representing each active project without a problem. How do you get an instance of IVsBuildableProjectCfg per project?
Ideally, I want to hook into the build event of each project to know whether or not each build is successful, as well as hooking into the solution to see if the overall build was fired.
(I also tried using the DTE2.BuildEvents, but my handler would never fire when I ran the debugger.)
Thanks!
Here's how you can get the active IVsBuildableProjectCfg for a given IVsHierarchy which I call ppHierarchy below:
IVsSolutionBuildManager buildManager = (IVsSolutionBuildManager)GetService(typeof(SVsSolutionBuildManager));
IVsProjectCfg[] ppIVsProjectCfg = new IVsProjectCfg[1];
buildManager.FindActiveProjectCfg(IntPtr.Zero, IntPtr.Zero, ppHierarchy, ppIVsProjectCfg);
IVsBuildableProjectCfg ppIVsBuildableProjectCfg;
ppIVsProjectCfg[0].get_BuildableProjectCfg(out ppIVsBuildableProjectCfg);
Then you can subscribe to build events using:
uint pdwCookie;
ppIVsBuildableProjectCfg.AdviseBuildStatusCallback(new MyBuildStatusCallback(), out pdwCookie);
Where MyBuildStatusCallback is an object you create that implements IVsBuildStatusCallback.
I hope this helps!
You can do this with some macro programming:
Hit Alt-F11 (shortcut for the Macro editor, and we all know keyboard shortcuts are cool).
From Project Explorer, double click EnvironmentEvents.
From the left dropdown (where it says General), select BuildEvents:
4. From the right dropdown, select the event you're interested in (OnBuildDone for example).
5. A new Sub is added, place the code you'd like to run when a build is done.
6. Save, and close the Macro editor.
7. Build your project. The code you entered should execute once the build is done.
Hope this helps!
Here is my app status:
Purpose - download multiple list files from internet
Approach - created a simple "download form". After a while, I just needed more forms because I had more than one list of files to download. Just solved that by adding a MDIform to my project, add a button to create another "download form" instance and voilĂ . Apparently, my problem was solved. But no :(
When I press my "download" button in my form-instance3, the other form instances (2 and 1) hangs on downloading the contents (I get a timeout sometimes) until the form-instance3 terminates all the downloads and so on, for all the other forms. So, even though I know my app is not multi-threaded, the multiple instances of the same form are in conflict (Inet component, presumably) and I can't download multiple files at the same time.
Inet and my download function are defined in the form.
What can I do to solve this? how can I download multiple files at the same time?
edit:
I'm trying to use the "wqw" suggestion, but I'm facing some problems:
In the download_form, I have a MSHFlexgrid, with 2 columns: one with the URL and the other with the file destiny. I was iterating throw all rows to download the files and save them. With the approach suggested by "wqw", how can I distinguish each download so that I can save it with the properly name indicated in the grid?
What do you use for the actual http download? I would try Simple Asynchronous Downloads and forget about the MDIForm. Really!
VB6, on its own, is single threaded. So breaking out downloading to different forms won't help you.
What I've used in the past is the Timer object in conjunction with an ActiveX EXE. This approach will give you an ability to localize all the downloading logic in one place, control it like you control a regular object and have it run in a separate EXE, thus by default making it multi-threaded.
So the way this works is like so:
You call the Download method on the ActiveX EXE object
In the download method, you instantiate the Timer and have it kick off almost immediately.
You get out of the Download method, thus giving control back to the entity that called it.
Then you communicate back to the main app via Events (e.g. DownloadProgress or DownloadComplete, etc...)