Examine contents of a nuget package - nuget

Is there a way to examine the contents of a NuGet package to see what changes it will be making? There is no option for this on the Nuget.exe command line and I do not find any information about this in the NuGet docs.

.nupkg files are just ZIP files with some metadata, so you can have a look at the contents. The NuGet Package Explorer should make it a little easier to view the contents.
The NuGet Gallery (e.g. https://www.nuget.org/) has a "Download" link on the right hand side, otherwise just install the package into an empty project and then take a peek.

Windows Users:
As Jonathon Rossi pointed out,
.nupkg files are just ZIP files, so you can have a look at the contents
So on a windows machine, for a temporary fix, just change the file extension from .nupkg to .zip, and then just use Windows' File Explorer to leverage the existing file association for .zip (CompressedFolder) files.
It is possible to "permanently" associate .nupkg with your system's CompressedFolder tool. However, this will corrupt the IconCache.db at the very least, and the typical method to restore it does not work for me (deleting the IconCache.db and rebooting). So I would recommend against associating .nupkg with CompressedFolder if you are concerned with seeing the correct file icon in File Explorer.
With that in mind, if you want a longer term solution for opening .nupkg files without changing their extension...
You can set a file association easily via a command prompt (cmd) like so:
These files will now have the same icon as any other CompressedFolder on your file system, and you can leave their extensions unchanged (as .nupkg).
To undo this association, repeat assoc command for the .nupkg but leave the RHS blank:
You can confirm the current file association at any time by running assoc .nupkg, dropping the equals sign (=).:

Another solution would be to use DotPeek.
It has an option to decompile packages from NuGet directly and NuGet caches.

Related

I cannot access MANIFEST.MF, but the jar file has one. How could I access and edit it?

I try to execute a jar file in the command prompt, but I always get the message 'no main manifest attribute, in 2056751-0.0.1-SNAPSHOT-src.jar'. So, I guess I should edit the manifest file. If I check it in the command prompt with the command 'jar tf 2056751-0.0.1-SNAPSHOT-src.jar' I can see that there is a MANIFEST.MF file, still I cannot see it in Eclipse project view.
To partially answer the question asked, IF on Windows (which you didn't say and isn't the only system with a command prompt), a jar file is really a ZIP file underneath and Explorer in all supported versions (>XP/S03) can treat a ZIP file as a directory subtree, so just rename to have the extension .zip and open in explorer, go to META-INF, select MANIFEST.MF and open with plain-text editor of your choice such as notepad. However this may not allow you to edit; if so copy to somewhere writable like the desktop, edit, then copy or move back. Then rename back to .jar
Although the manifest file in a jar can be loaded from an actual file, usually it is created by the jar tool. If you want a jar containing classes to run from the usual file association on Windows use the jar tool with the e option as described in the man page or Windows version on the web and help message. However if your file name is accurate and this is actually a source jar, it will never be runnable by only changing the manifest and you need to learn how Java works.

Is it possible to rename a folder in Nuget

I'm creating a nuget package to install some ascx files into a solution. The folder i want the ascx files to be stored in will be different depending on the project. IE folder name will be the same as the project name.
Is it possible to have a pop up to capture text so I can rename the folder in the content section of a nuget package during install. Is it then possible to add this folder name to the namespace of the files within the folder?
I know its possible to add $rootnamespace$ with a .pp extension to replace the key with the correct root namespace, but can you append to this too?
You ought to look into the options for Automatically Running PowerShell Scripts During Package Installation and Removal.

Nuget how to add files to solution folder

I have a package that contains some files that I want added at a solution level rather than a project level. I am able to add a folder at the solution level, but cannot determine how to add my files into to this folder.
You can do this by placing your code in the init.ps1 file. install.ps1 only executes with project-level packages. Because the code will be in init.ps1, it will run every time the solution loads - not just at install. so you will need to safeguard against re-execution. See this post for a code example - You'll just need to add a step to copy from the tools folder to the solution folder.

How to have different file links to an Eclipse project (not importing it)?

I noticed when I import a file, the file is copied to the work space, but can I just create a file link in a Eclipse project? So when I modify the files in Eclipse, the files in the linked location is modified. In this way, I can version control the files using SVN. And I don't need to copy the modified files back to its dedicated directory when deployment.
The following is a more detailed description of my problem:
I have a cgi application located and runs in apache. The app runs with diff configuration files for different 'projects' which is more like showing different dataset with its corresponding configuration file. My task is to write the configurations files which will require some perl callback functions, css files and images. All these files have their own dedicated directories located in different places in the company server which i have not much control with.. So far, I just use command line to modify files and keeping old copies for version control. If I can do something like my above description, I will be able to have a central place to work on and do SVN. Or do you have a better idea how I should set up my work environment?
Thanks heaps in advance.
Yes you can,
File -> New File -> Advanced (at the bottom) -> Link to file in the file system
Manu
I have figured out a way to conveniently to version control files from different places and can deploy them to the correct directories after modified. It's ....... using..... the ANT build file... I just have all files imported to a single project and use an ANT build to distribute them back to their corresponding destination.
Use svn:external http://svnbook.red-bean.com/en/1.0/ch07s03.html
One drawback though, you have to update your other projects once you commit a shared files.

Resources check

hey I am frequently uploading my XCode iPhone projects to an svn repository to be build on another machine.
My problem is that when I add resources to my project sometimes I forget to add the resource as relative to the project.
I know one answer is to be more careful (not easy when your tired!) but if there was a way to run a script to check my resource paths are relative when I build and warn me if they are not it would be a great time saver for me.
How would I go about doing this?
Thanks
Chris
You can select all the files in your project and set the Path Type for all of them in one go. While this isn't a script this does save a lot of time over doing the files individually
I think the best approach to script this would be to look in the .xcodeproj file - the file paths are listed in there. If your project is called MyProject you need to open (either by using Show Package Contents in Finder or just the usual cd in Terminal) the MyProject.xcodeproj directory.
In here you'll find a file called project.pbxproj - open this in a editor that won't mess up your formatting and have a peek around the file. If you search for one of your files in the project you should be able to see how Xcode stores references to the project files.
Look for a section named /* Begin PBXFileReference section */. In here all your files are listed, along with where they are relative to the project, e.g.:
... path = Classes/MyClass.h; sourceTree = SOURCE_ROOT
If you can parse this file you should be able to acheive what you want - but remember to back up the file, otherwise you might corrupt your project.
How would it be if you instead write a script that asks the SCM if anything in the project is not committed? For example, think of this scenario
Project Root
Codex
Project.xcodeproj
…
Design
anImage.png
where anImage.png being outside of Codex, where the Xcode project sits (its path starts with a ../). A strong .pbxproj parser would have to support all the variants in which Xcode references files to know exactly if there are stray files.
OTOH, the SCM knows where everything is all the time (you mentioned up-ping to a SVN server), so why not ask it instead.
We have a Ruby script that prints a warning in Xcode’s Build Log if anything in the project is not committed.