I wrote an VS.NET add-in that must check-out a file, modify it and then
checking the file in.
How can I get a reference to current solution's IVSSDatabase (if there is
any) ? Or, how can I programatically check out an item from the solution, by
knowing the item's full path ?
Thank you,
--
Catalin STAVARU
Project Manager
-------------------------------------
SOFTWIN
Data Security Division
-------------------------------------
phone: (+4) 021 233 18 52; 021 233 07 80
fax: (+4) 021 233.07.63
Bucharest, ROMANIA
http://www.bitdefender.com
http://www.softwin.ro
-------------------------------------
secure your every bit
-------------------------------------
> I wrote an VS.NET add-in that must check-out a file, modify it and then
> checking the file in.
>
> How can I get a reference to current solution's IVSSDatabase (if there is
> any) ? Or, how can I programatically check out an item from the solution,
by
> knowing the item's full path ?
Not always VS.NET and VS at all are working with the VSS.
It's possible that VS are working with another version control system.
VS always works with Source Code Control providers, but they don't have
such notion as a path to database.
Try to read "Source Control Service" topic in MSDN, may be you will find
something suits you.
____________________________________________
With best wishes, Arthur Nesterovsky
Visit my page, please: http://www.nesterovsky-bros.com
I wonder, is there any other (publicly disclosed) method to access the
current SCC provider methods using VS.NET automation ?
"Arthur Nesterovsky" <art...@nesterovsky-bros.com> wrote in message
news:eIvwiAyM...@tk2msftngp13.phx.gbl...
I'm afraid no.
There is another way:
IDE by itself does everything, you just supply wrapper for Source Code
Control provider.
In such wrapper you will route the requests to and responses from the
current provider with
ability to implement your own functionality.
But how about this ? I managed to get the GUID's and ID's of check-out and
check-in commands issued by the IDE itself on selected files when I
right-click the files and select "Check-out now"...How about issuing those
commands myself from the add-in ? (like miming the IDE). Would this be a
crazy idea ? I can issue the command, but the only thing I don't know how to
do is to programatically "select" the files I need to run the command on.
"Arthur Nesterovsky" <art...@nesterovsky-bros.com> wrote in message
news:e4cir%23zMDH...@TK2MSFTNGP11.phx.gbl...
> But to write a SCC provider wrapper implies to know the SCC provider API
> which can only be obtained under a NDA from Microsoft, right ?
Yes, I are right.
> But how about this ? I managed to get the GUID's and ID's of check-out and
> check-in commands issued by the IDE itself on selected files when I
> right-click the files and select "Check-out now"...How about issuing those
> commands myself from the add-in ? (like miming the IDE). Would this be a
> crazy idea ? I can issue the command, but the only thing I don't know how
to
> do is to programatically "select" the files I need to run the command on.
Actually I don't know what to say you. ;-/
It seems to me that you will run in more complex task than I had suggested.
Since I've not found anything for check in files from IDE.
Now, with this method it seems that from an add-in you can do anything a
user can do :)
"Arthur Nesterovsky" <art...@nesterovsky-bros.com> wrote in message
news:eRDl0b9M...@tk2msftngp13.phx.gbl...
So, how?
You need the following things:
the Commands collection of the DTE object;
the UIHierarchy object of the Solution Explorer, from the DTE object (using
the GetObject method).
Then, you have to build a path to the file F using the names of the nodes
that you obtain recursively searching the UIHIerarchy for the file F.
Having this virtual path, you obtain a pointer to a UIHierarchyItem object
corresponding to the file F ( by calling GetItem method of UIHierarchy ).
(more info in MSDN).
Then, select the item (using the Select method of UIHierarchyItem). It's
like the user selected the item in solution explorer.
Then, using the pCommands object, issue the command (using the Raise method)
having GUID of {AA8EB8CD-7A51-11D0-92C3-00A0C9138C45} and ID 11157 for
CheckOut, and ID 11155 for CheckIn. Then you will notice that the item was
checked out :) (or in).
Of course, there are a few more details but these can be easily figured out.
"Arthur Nesterovsky" <art...@nesterovsky-bros.com> wrote in message
news:%23$D9C4$MDHA...@tk2msftngp13.phx.gbl...
I use a similar method in my SyncVss product (www.thecreeksidegroup.com) to
intercept VSS events. You might also want to explore the many different ways
that you can do a checkin/checkout, you'll find that there are several ids
for each of those commands. So you might miss a checkin/checkout if you only
look for those id's...
Paul D'Anna
"Catalin Stavaru" <csta...@xnet.ro> wrote in message
news:uVPvlJAN...@TK2MSFTNGP10.phx.gbl...
Since then I've written a custom program that given the
path and name of any solution will determine if the
solution is under source control and if it is will then
process the solution file to get the pointers to VSS
database used and the paths to both the internal VSS path
as well as the local path of the project(s) contained in
the solution. The reason I did this was mostly to change
the version info in the AssemblyInfo.vb file, but it also
serves to give me more granular control over an entire
solution.
>.
>
> How can I get a reference to current solution's IVSSDatabase (if there
any) ?
SourceControl integration code in VS does not use the IVSS interface (this
interface is SourceSafe specific).
Instead, VS talks with different source control providers via MSSCCI (that
one that can be obtained after signing an NDA
- if you're interested in that interface, send an email to
mss...@microsoft.com)
> No check-in methods are supplied (why ?).
That's right, there are no Get/Checkin/Methods to the SourceControl
interface because the purpose of this interface was to be used in
automation,
where no UI can be put up during the command execution, otherwise the script
will stop and wait for user input.
The only suitable method was checkout, which can be silent.
All other operations might display UI (e.g. in checkin case the merge
conflicts dialogs), and this UI is scc-provider specific.
VisualStudio cannot controll what UI will an scc provider decide to display,
since there are no MSSCCI flags that can be used to tell providers to be
silent.
I saw that you found a solution in the end by using the 11155 and 11157 IDs
and executing the menu commands directly.
These commands are indeed the context menu's silent commands for checkin and
checkout.
Note however that they are "silent" only in VisualStudio's side - the
provider might still display dialogs as it pleases
- and this solution might not be always suitable to be used in automated
nightly build scripts.
Alin
P.S. For my curiosity, what tool did you use to get these IDs/GUIDs?
--
Alin Constantin
[This posting is provided "AS IS" with no warranties, and confers no
rights.]
"Catalin Stavaru" <csta...@xnet.ro> wrote in message
news:%23oEr2Nz...@tk2msftngp13.phx.gbl...
There is a very simple "EventWatcher" add-in available straight from
Microsoft :)
Here:
http://msdn.microsoft.com/vstudio/downloads/samples/automation.aspx
But I have a question too:
Is there anyone from Microsoft Visual Studio.NET's developer team that
answers questions about VS.NET automation like you do on SourceSafe ?
I want to manipulate a .rc file using Visual Studio.NET automation model. It
is easy to be done for code files (.cpp, .h) but is seems impossible to
obtain an edit object associated with a resource file.
Apropos, eu sunt din Romania, dupa nume se pare ca si tu esti :)
"Alin Constantin [MSFT]" <cn...@tfosorcim.moc> wrote in message
news:%230iUfMF...@tk2msftngp13.phx.gbl...
If I understood correctly, there isn't a well-defined newsgroup for
automation questions.
People usually post them in newsgroups more related to their application
programming language, or to the features used (like in this case VSS group
was involved).
You might get some answers from VC groups (perhaps
microsoft.public.vc.res_editing or microsoft.public.vc.ide_general)
Also, I've heard that on yahoogroups.com there is a vsnetaddin group good
for automation questions.
You could also contact Craig Skibo (craigs) or Ken Hardy (khardy), they work
on the DTE automation model and they might be able to answer better or
redirect to someone more appropriate.
--
Alin Constantin
[This posting is provided "AS IS" with no warranties, and confers no
rights.]
P.S. Yes, I'm from Romania, too...
"Catalin Stavaru" <csta...@xnet.ro> wrote in message
news:OitUbULP...@tk2msftngp13.phx.gbl...