more recentlyy some studi...

ZipStudio - A versatile Visual Studio add-in to zip up Visual Studio solutions and projects - CodeProject
Sign in using
145.2K views2.3K downloads66 bookmarked
&4.56 (20 votes)
4.56/5 - 20 votes2 removedμ 4.10, σa 2.45 []
Rate this:
This article presents a versatile way to zip up Visual Studio (VS) solutions, projects, and/or any selected items in the Visual Studio Solution Explorer window, directly to a zip archive. The approach used is, in general, different from that provided by other solutions to this problem. This addin uses the Visual Studio automation object (EnvDTE namespace) to enable it to decide what project items are to be included in the resulting Zip file. This approach has the following advantages:
Only the selected items in the Solution Explorer window will be added. So, the solution and/or individual projects can be zipped, or individual folders in those projects, or right down to individual project items. The rule for this works as follows: if the solution is selected, all files will be added to the Zip files, if a project is selected, all files for the project will be added. If a project item is selected, and its parent project and the solution is not selected, only the item itself will be added. If the selected item is a folder, all the items in the folder will be added.
It works with ALL projects tested in the VS environment, as it uses VS itself to decide what the individual projects consist of. It has been tested with all C#, VB, C++, Deployment (.vdproj), and also the InfoPath SP1 Preview (.ipproj) projects. Furthermore, it works correctly with the Solution Items folder and all project folders in the projects themselves. It also correctly resolves item dependencies, such as a form item consisting of a .cs and .resx file (in the C# case).
If the 'Show All Files' option is chosen for a project in the Solution Explorer window, any shown item(s) may be selected to be added as well, even though they are not seen by VS to be part of the project.
If a new project type is added to the VS environment, the should still continue working, as it makes no assumptions about any type of project, other than the project hierarchies exposed by the DTE automation object itself.
Lastly, but most importantly, the code is relatively simple and concise (once you understand the DTE object model), and does not require the parsing of XML-encoded project files which at a minimum is tedious and the code is mostly fairly convoluted. Instead, this addin spends a lot of time navigating collections of objects provided by the DTE automation object.
The downside to this approach is:
The Zip file can only be created inside Visual Studio, and the implementation is not available (currently) as a standalone executable, or a File Explorer shell extension.
It works ONLY for the Visual Studio .NET ) and ) environments. It does not work for any releases of VS which do not have the .NET badge. Sorry for you, VS6 users...
Being in the contracting game requires us to program on client sites, and often to work with the same code off-site. One way to backup the code efficiently is to provide Zip file functionality directly in the VS IDE, and the obvious way to do this is to implement the addin which works directly with the VS automation object and the EnvDTE.Solution, EnvDTE.Project, and EnvDTE.ProjectItem objects for the currently-loaded solution.
There are essentially two components to this addin:
A VS wizard generated C# component, suitably modified and implemented as described below, and
The actual Zip file implementation code. For this, I used the implementation provided by #ziplib, a library written by Mike Krueger at . The library is written in C# (which makes it 'clean' and easy to incorporate in this addin), and it is available as source-code, if required. The #ziplib (or SharpZipLib) may be downloaded .
To use #ziplib in your application, simply add a project reference to the .NET module ICSharpCode.SharpZipLib.dll in your VS.NET project and start hooking up the #ziplib objects.
The Windows Installer provides a standard Windows MSI module to install the ZipStudio addin for Visual Studio. Simply extract the files from ZipStudio_inst.zip to a folder and run setup.exe. When you run VS, a menu for the addin will appear in the Visual Studio 'Tools' menu. The addin menu will contain an icon and the menu text ‘Add to Zip file..’. Initially, the menu is disabled until a solution is loaded (or created) in VS. Select some items in the VS Solution Explorer and click the menu item. The Zip Studio window shown in Figure 1 below will appear.
Please note that if the addin is repeatedly installed/un-installed, it may be not appear to be installed and the addin menu may not appear even though the installation executed successfully. In this case, quit all running instances of Visual Studio and execute the file RecreateCommands.reg which is included in the ZipStudio project. The file consists of the following text:
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\7.1\PreloadAddinState]
"ZipStudio.Connect"=dword:1
If you now run Visual Studio the menu should appear. The registry setting in the file ensures that the addin is preloaded when Visual Studio starts up.
Figure 1 below shows the ZipStudio window as it appears in the Visual Studio IDE.
Figure 1: The ZipStudio Addin window as it appears in Visual Studio
The following user-interface controls can be seen:
Zip File Path
This text box provides the file path of the Zip file that will be created (or updated). The default is the same path as the current solution file (obviously with a .zip instead of a .sln extension). This name can be set to whatever valid file path you like. The '..' button to the immediate right of the file path text box can be clicked to browse for the Zip file.
Included File List View
The list view shows all the files that will be included in the Zip file. The list can be sorted by any of the ‘Filename’, ‘Filepath’, or ‘Date Modified’ columns by clicking on the respective column headers.
Save Full Path Info
Setting this option works similar to the WinZip option with the same name – The full paths of the files are saved but does not include the actual drive letters. The full path ‘D:\ZipStudio\ZipStudio.cs’ is stored as ‘\ZipStudio\ZipStudio.cs’.
If this option is not set, the addin will attempt to save the file paths relative to a common root directory for all the files in the list. In the following set of files with file paths:
C:\InetPub\wwwroot\Website\Webform1.cs
D:\ZipStudio\ZipStudio.sln
D:\ZipStudio\ZipStudio\ZipStudio.cs
the addin will attempt to find a root path for the files and because the files are on different drives, the full paths for the files will in fact be saved. If only the second and third file are part of the list, the common root path will be ‘D:\ZipStudio’, so the path for the solution file will be ‘ZipStudio.sln’ and ‘ZipStudio\ZipStudio.cs’ for the C# file.
Save Settings
If this option is set, the Zip filepath, and the Zip file group options (described below) are saved as part of the VS solution file. This may be a problem if the solution is shared by multiple users or is controlled by a source-control system such as Visual Source-Safe. To ensure that this does not occur, keep this option un-selected.
Add Only Modified Files
When the addin is started up Visual Studio, it flags the current date/time. During the session, as files are edited, their modified date/time stamps are more recent than the addin startup time. Setting this option allows only these recently modified files to appear in the included file list.
Add Miscellaneous Files
Visual Studio maintains a list of files open in the editors in an internal project with the UniqueName ’&MiscFiles&’. This project does not have a file path and is not saved. By setting this option, all files that are open in VS that are not part of any project or solution files can also be included in the Zip file. Setting this option unchecked will ensure that only files which are required for the VS Solution to load and build successfully are included.
Reset File List
Any files manually removed in the ‘Remove Selected Items’ function below, are added back into the list of files included in the Zip file by clicking this push-button.
Remove Selected Items
The user has the opportunity to remove any files from the included list, by selecting them and then clicking this push-button. Any files so removed can be re-added by clicking the ‘Reset File List’ push-button.
Open Folder After Creation
Setting this option will open the containing folder for the Zip file in the File Explorer and set the file selection to the Zip file after the file is created.
Shell Open Zip File
Setting this option will open the Zip file with the application associated with the .zip extension.
Create Zip File
Clicking this push-button creates the actual Zip file.
The source-code for this addin is provided in the file ZipStudio_src.zip. Extract the files to a folder of your choice, ensuring that the 'Use folder names' option is set (assuming that you are using WinZip). To build the , open ZipStudio.sln in VS. Please note that the addin was originally built in VS.NET 2003 and that the Setup project ZipStudioSetup.vdproj has registry settings which will only work for VS.NET 2003.
The following is provided to assist your understanding when working through the source code.
In the DTE object, the Solution object consists of a Projects object, which is a collection of Project objects. In turn, a Project object consists of a ProjectItems object, which is a collection of ProjectItem objects. A ProjectItem object provides a set of file paths associated with the project item. As far as can be ascertained, a single file path is used for every project item.
The basic code for starting the file selection for inclusion in the Zip file is as follows:
if(this.DTE.SelectedItems.Count & 0)
for(int i = 1; i &= this.DTE.SelectedItems.C i++)
SelectedItem item = this.DTE.SelectedItems.Item(i);
if(item.Project == null)
if(item.ProjectItem == null)
Solution solution = this.DTE.S
if(item.ProjectItem == null)
A file path for every possible item can be found as follows:
string filePath = null;
if(Item is Solution)
filePath = ((Solution)Item).FullN
if(Item is Project)
filePath = this.GetProjectFullName((Project)Item);
if(Item is ProjectItem)
filePath = ((ProjectItem)Item).get_FileNames(1);
In the code above, special handling was required to get the correct file path for the Project object: a combination of the Project.FullName and Project.UniqueName had to be used. The reason is that every project type except the Deployment project (.vdproj) correctly reports the file path in the FullName member. The deployment project does not specify the file extension. However, it does so in the UniqueName member, but this value seems to be either a URI or a relative path. The following method fixes that bug by combining the two members to provide the correct value:
private string GetProjectFullName(Project Project)
string filePath = Project.FullN
int extIndex = filePath.LastIndexOf('.');
string filePathExt =
(extIndex & 0) ? filePath.Substring(extIndex + 1) : "";
extIndex = Project.UniqueName.LastIndexOf('.');
string uniqueExt =
(extIndex & 0) ? Project.UniqueName.Substring(extIndex + 1) : "";
if(filePathExt != uniqueExt)
if(filePathExt == "") filePath += "." + uniqueE
else filePath = filePath.Replace(filePathExt, uniqueExt);
return fileP
The following code snippet shows the method used to open File Explorer, navigate to the folder containing Zip file, and select the Zip file:
string cmdLine = "/select,\"" + ZipFilePath + "\"";
Process.Start("explorer.exe", cmdLine);
The following code snippet shows the method used to open the Zip file using the application associated with the Zip file extension:
Process.Start(ZipFilePath);
If you follow the source-code, you will realize that it is relatively simple. The most difficult part was to code for the exceptions (bugs?) that the different projects exhibited. The InfoPath project (.ipproj) does not appear to implement the ProjectItem.SubProject or the Project.UniqueName members, and any attempt to address these member results in an exception being thrown. The way around this is to place a try..catch block around the code that uses those constructs.
A Hashtable object was used to collect the include files and is keyed by the file paths. This allows 'no-brainer' adding of items while ensuring that all items are added once only. If you recall the rule-set that is applied in adding files to the Zip file, it is obvious that implicitly many items can be selected more than once.
The performance of the addin is very good, allowing the addin to actually run the method that collects the files every time the menu has to be updated. In the case where no files are effectively included, the menu item is disabled in the QueryStatus method of the addin.
This article does not discuss the infra-structure code required to get the addin to behave correctly or appear presentable in the VS environment. The addin implements the following features which are not discussed in this article:
A custom icon for the menu item. The way to do this is adequately handled in .
The addin can save the last settings for the Zip file path and the other Zip File options. It was decided not to use the Windows registry to do this, as it would be a useful feature to have the settings saved uniquely for every VS solution. Another option is to use a separate file (probably XML) to save the settings, but this adds another file to the solution directory, and can easily be deleted outside the VS environment. An elegant solution is to save the settings in the solution file itself! This is done using the Solution.Globals member. The excellent Code Project article:
describes this in detail.
The following are regarded as useful modifications to this addin:
Recreate the VS DTE object outside the VS environment and thus provide a separate application or a File Explorer shell extension to directly zip up VS solutions or projects.
Allow the Zip file to be opened from VS. A nice feature here would be to not only extract the files directly from VS, but also to re-root the files to a new root folder(s) of the users choice.
Version 1.10: 13 June 2004: Second release.
Fixed and improved relative/absolute filepath saving for included files. The addin now attempts to save relative file paths rooted from a common folder for all included files.
Included the option to add only files updated in the current VS session by testing each file modified date/time stamp with the date/time the addin was loaded by VS.
Included option to selectively removed files from the included file list.
Included option to include files in the VS &MiscFiles& internal project.
Included option to dis-/-allow saving of Zip file path and Zip file options in the VS Solution file.
Included help information tool-tips on all user input controls.
Version 1.00: 13 May 2004: First release.
This article, along with any associated source code and files, is licensed under
Web Developer
South Africa
I spend most of my time in the .NET world.
I am a Systems Analyst/Consultant and Software Developer by trade.
I cut my programming teeth with HPUX/C++ way back in the late '80's, but have since dabbled in most software technologies and languages since then.
I run my own company in South Africa, providing mainly software development services on a contractual basis, but I'm game for just about anything in the software development space.
I am not a Microsoft bigot, but they have to be commended for the whole .NET initiative. I think they hit a six (for the cricket players out there), or a home-run (if you prefer baseball)...
Check out my little website - there's a whole bunch of .NET goodies there...
Comments and Discussions
General &&
Suggestion &&
Question &&
Admin && Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
Last Updated 15 Jun 2004
Article Copyright 2004 by Willem FourieEverything else
Copyright & ,Source : stackoverflow
In Android, Edited: Don’t suggest Interface, please. I have an Activity with a RecyclerView inside. I want post an event from Adapter to Activity by otto, when Adapter will be created. I used following code: ShoppingCardAdapter public class ShoppingCardAdapter extends RecyclerView.Adapter&ShoppingCardAdapter.ViewHolder& { private A private CardB public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { public TextView tvBookN public ViewHolder(View v) { super(v); tvBookName = (TextView) itemView.findViewById(R.id.tv_book_name); } @Override public void onClick(View view) {
In Android, I want to set up my toolbar as an actionbar, but since your toolbar is a layoutelement it has to be in your layout. Now my layout is in my fragment. I added the toolbar in my layout and I call it within my fragment: //Toolbar Toolbar toolbar = (Toolbar) getActivity().findViewById(R.id.toolbar); It works because I can set the title and so on but now I want it to react as a actionbar because
In Android, In one out of ten cases, the list is not updated, I can not understand why this is happening. I’m trying to update listview(which initialized in fragment) from MainActivity after creating new item I calling this method: public void updateListView(){ mainActivity.getSupportLoaderManager().getLoader(ALARM_LOADER_ID).forceLoad(); adapter.swapCursor(getCursor()); } getCusor() – is method as you see return Cursor from DB, I checked it on the correctness of the request. MaiActivity void create(AlarmsFragment f,boolean isRepeat){ //some code if(f!=null) f.updateListView(); }
In Android, Yes, I know this is a duplicate: Android Service : bind or start?. But as I commented there, the answer given is problematic. In the Google Dev Tutorial, binding is recommended as ...would work well for a music application that needs to bind an activity to its own service that's playing music in the background. Whereas the SO answer I just linked to says that’s the very kind of service I would need
In Android, I’m trying to setup push notifications for our app that uses quickblox. I’ve uploaded the correct iOS certificates and Google Keys, I can: Send from iOS to iOS Send from Android to Android Send from Android to iOS But when i try to send from iOS to android i get an error for the SDK: “No recipients. At least one user should be subscribed for APNS (Apple Push) (through SDK or REST API)”]
In Android, i created an app that show a listview with clickable items. i have an edit text to make the search. everything is working great but when im searching for an item, the app give my a new list, the probleme is when im clicking on any item on thisnew list items it redirect me to the link of the item in old list.here is my code: -For ReaderListAdapter.java : import java.util.L import android.content.C
In Android, i?m making a project with a friend and we h the program most connect to a server in java and send message but dont get anything form the server, the thing is that i already give the permission to connect to internet in the manifest and use this code as MainActivity package Er.net. import android.app.A import android.content.I import android.os.B import android.view.V import android.view.W import android.widget.EditT import android.widget.T public class MainActivity
In Android, Before asking this question, I have researched a bit on it and also looked for similar questions on SO, none of which seemed to answer it. I am planning to provide visual accessibility feature in my android app where users will be able to negate the color of UI in one go(lets say a simple button to negate the colors). There are few exceptions though. There are few views(say action bar) whose color
In Android, i would like to be able to use the browser as an editor for sms on my android device (something like ). so i started to write an android app which acts as socket server and use the browser as client (such as http://www.websocket.org/echo.html). i was able to reach my app from that client and get messages from it, but im am having now problems with the WebSocket handshake (Sec-WebSocket-Key etc). EDIT: i
In Android, It appears trivial even on the ‘Usage’ section here My edit text appears just the same, when i type on it everything appears as usual, when i select text everything is still normal. No “FORMAT” entry on the action mode. What am I doing wrong?? My layout: &monsware.cwac.richedit.RichEditText android:id="@+id/editTextSermon" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="top" android:hint="@string/type_the_sermon_here" android:lines="10" android:imeOptions="flagNoExtractUi" android:inputType="textMultiLine"& &requestFocus/& &/monsware.cwac.richedit.RichEditText& In my activity: sermonText = (RichEditText) findViewById(R.id.editTextSermon); sermonText.enableActionModes(true); From the documentation that is all I
In Android, I am still new in libgdx and confused, i want some button in my games(always in bottom left screen) for make some event (use item, create soldier,etc). Where can i put this button in my games class? I have worldController class, worldRenderer class and GameScreen class (like in canyon bunny from libgdx ebook) I have tried add stage and button in worldRenderer class then draw it in one of renderGui methods but nothing
In Android, As I upload the images to server from app, I save a copy of that in the sent_images folder of my app.(The images are kept saved whether these are successfully uploaded Or not, for Retry purpose.) The problem is that I use the System.currentTimeMillis() +”.jpg” as the file name. But the file name may be repeated sometime in extreme case when the user backdates his device time. And unfortunately, the time the image
In Android, I’m new to android coding. My Gps connecting not showing the exact location address. Its just showing my town name n county name. How to make it to get specific address, like house number, street, city, etc. This is my current output. = Your Location is Kajang 43009 Malaysia MY This is location.xml &?xml version="1.0" encoding="utf-8"?& &RelativeLayout xmlns:android="/apk/res/android" xmlns:tools="/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" android:background="@drawable/wallpaper" & &TextView android:id="@+id/textlocation" android:layout_width="300dp" android:layout_height="130dp" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:text="Location" android:textSize="35dp" /&
In Android, MainActivity.java file I want to make a list whose numbers corresponding length of the array . and display the value of the array element into the list this is MainActivity.java file package com.tolhedo.akew.mycardview2; import android.support.v7.app.ActionBarA import android.os.B import android.view.M import android.view.MenuI import android.support.v7.widget.LinearLayoutM import android.support.v7.widget.RecyclerV import java.util.L import java.util.ArrayL public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); RecyclerView recyclerView = (RecyclerView) findViewById(R.id.cardList); recyclerView.setHasFixedSize(true); LinearLayoutManager layoutManager = new
In Android, I have a scenario where i have listings of TV Channels in which i have TV Shows/Serials, For each TV show we have episodes. We are displaying thumbnail Images/Icons for TV shows and respective episodes, By default every image/icon should be linear(Same) across all episodes as well as TV show. We have an Issue, where for some episodes Images mis-match. how can we solve this scenario, Using a Simple logic. PS: All Images
In Android, everybody. The android emulators are named as the format “emulator+$EMULATOR_PORT”, such as “emulator-;. I want to assign the concrete serial id for my emulator. Are there some advice? I have downloaded the source code of Android 2.3. Solution
In Android, This tutorial refers to the communicating between fragments but doesn’t do it for tabs. I want to send data between from my “Daycare” fragment which is a tab to my “You” fragment which is also a tab. I’ve been stuck for a week on this. I don’t really know how to combine the concept of interfaces with android tabbed fragments and data from asynctasks. I have created an interface in my Daycare fragment.
In Android, I’m trying to do something that I thought would be fairly common — Keep a local sqlite database on a user’s phone/tablet in sync with a copy that’s stored in their Google Drive app folder. The benefits are obvious — namely a user can use multiple devices, or replace their only device, and always get the latest database information, without resorting to manual exports/imports. For an implementation, I see that it would be
In Android, I am developing an android application that has to use two external cameras simultaneously. I want to know how can I use cameras. I have gone through many other answers but that were not clear. I want to get to know how to use camera in android Solution

我要回帖

更多关于 more recently 的文章

 

随机推荐