Nuget spec editing values via command line switches - batch-file

I'm making a library, and creating a nuget package using the nuget spec and nuget pack commands. However, every time I run nuget spec, I get a load of rubbish in the .nuspec file that I don't want (like 'SampleDependency') I was wondering if it's possible to add these values (Id, URL, etc.) via command line switches. From what I can see on the documentation, it's not possible, but I don't know if it's been left out or something similar. Also, if it isn't possible, how would I edit the .nuspec file in a batch to give it the values I want?

To your question around command-line switches. There are no commands to pass in the values you want. If you are packing a csproj instead of an assembly, you do get replacement token support and automatic dependency generation.
If you want to pack assemblies, you should be able write your own batch/powershell scripts to make the changes you need. Easiest thing would be a generate a nuspec, create replacement tokens (E.g $id$ for ID) for the fields you want to change and a do a replace before pack.This way you can create the nuspec file once, set it up and then substitute the values on each pack.

Related

creating a package in tcl from a list of tcl/itcl sources

I want to make a tcl package , and I am writing In tcl and also in itcl.
Now ,
My first problem is that I have couple of sources files that are included one in the other , so I am adding the command source that should do the include between them. If I create a package with the command package provide is this will still work?
My second problem is that I don't really know how to create this package.
I added to my upper module script the command package provide pack 1.0, but I understood that auto_path should be also updated and mk_index file should with sources in it.
I searched on the internet and couldn't find good example for it.
By the way , I created all my classes and procedures under the global namespace in my sources files , is it ok? or should I wrap them inside a new namespace?
So I searched a little bit more about it and found those two absolutely wonderfull websites:
https://www.tcl.tk/man/tcl8.5/tutorial/Tcl31.html
http://www.wjduquette.com/tcl/namespaces.html
it is explained there very good.

How extract deployment files from MSI database

MSI database contains set of tables, and I can successfully enumerate File table, which has all deployable file' meta-deta. What I need to extract is the actual contents of those files. msiexec, lessmsi, 7-zip all can do it, but I couldn't find any source/API to do it.
What I've discovered it that all other (resource) files are in Binary table, and Data field can be used to get content of those files (like icons, custom DLL etc).
Further, I found and know that Media table contains information about the .CAB file (MSI has all content embedded with <MediaTemplate EmbedCab="yes"/>. This simply means the CAB file contains the actual content. I probably need to read contents from "Structured Storage" of the .msi file.
How to extract the contents of CAB/MSI file, using native C Msi* functions?
Phil has given you the easy/simple answer but I thought I might give you a little more information since you've done some research. Checkout:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa372919(v=vs.85).aspx
This is where the structured storage is. You'll see something like Disk1.cab as the Name (PK) and binary data. The data is a CAB file with the file entry in the cab matching the File.File column. From there you can use the File.FileName column to get the short name and long name (you'll want the long name no doubt) and do a joint to the Component table to get the directory table ID.
You'll also need to recurse the directory table to build the tree of directories and know where to put the files.
Fun stuff. There's some libraries in C# that make this WAY simpler. Or just call msiexec /a as Phil says. :)
The most straightforward to extract all the files to some location is to install the product in "advertised" mode. If you do a:
msiexec /a [path to msi] TARGETDIR=[some folder]
you'll see what happens.
In C++ call MsiInstallProduct () with that command line.
You have gotten many good answers already, including the use of dark.exe from the WiX toolkit. By downloading the WiX source code you should be able to get the code you need ready-made from there. I assume you may already have done this.
Chris has already linked to the DTF code you can check, but here is a link directly to dark.exe as well: https://github.com/wixtoolset/wix3/tree/develop/src/tools/dark. I would try both. This is C#, you seem to want native.
UPDATE: Before I get to the Win32 features you can use, check out this little summary of the C# DTF features: How to programmatically read the properties inside an MSI file?
Native Win32 functions: The database functions to deal with an MSI file can be found on MSDN (this is to deal with the MSI file as a database). There are also MSI Installer Functions (used to deal with the MSI file as an actual installer).
You can certainly find good examples of native code for this with a good Google search. Have fun!
BTW: It would help with a description of the actual problem you are trying to solve as well as what you need technically. There could - as always - be less involved ways to achieve what you need. Unless you are writing a security software or malware scanner or something super-involved.
And so it is clear: WiX's dark.exe fully decompiles MSI files into WiX source files and the resource files used to build them - you can then text and binary compare the various types of content (text compare for tables, binary compare for binaries, etc...). The process to do so via command line is described in the following answer: How can I compare the content of two (or more) MSI files? (this is about comparing MSI files, but one option to do so is to decompile them - see section on dark.exe - just for reference for others who find your question).
I like to link things together so we can find content easily at a later point in time. Strictly speaking it doesn't seem necessary here, you have what you need I think but others could perhaps benefit from some further links. Here are some related links:
Extract MSI from EXE.
What is the purpose of administrative installation initiated using msiexec /a?
How do I extract files from an MSI package? (explains why you should not use 7-Zip to extract).

Include tcl.h into C project

I need to use tcl.h in my C project (VS 2012) for registering function in SQLite. I have downloaded Tcl for windows and installed it. But my project still doesn't recognize when I write #include . What should I do to get access to this header?
Thanks in advance.
Open the project properties and do :
Right click on your project, go to properties, go to C/C++ session. On the field Additional Include Directories, add the path to the header you want, and use the header with "".
After that, you should go to the Linker session. On General, go to the Additional Library directories and add the path to the libs you need to add. Then go to Input and add the lib.
Sometimes you will need to copy a dll to the same folder of your executable. You can do that on Custom Build Step - Post Build Events.
You need to do it for each configuration and platform you want to build - one tip to make it easier is to use those variables $(Configuration) and $(Platform) when you are specifying the paths, and select on the dropdown list of the top of the properties window All configurations and All platforms, so you don't need to do it several times per project.

How to create a batch file that checks for EXE version then does an action?

I checked around but didn't get this specific detail. I want to create a batch file that Checks if the version is equal to the version i specify and performs an action accordingly, in this case it would exit. The point from this code is that it would check if the newer version is created and would exit if it is fulfilled.
Program EXE files contain version information in a resource inserted in the file. The information is visible in the Windows Explorer when you view the properties of program files, but unfortunately Windows has no command line utility to access it. But it is not dificult to write such utility, because the API GetFileVersionInfo is fully documented. Some third party tools, some of them open source, exist. A little quick Google on the subject has lead me to some links.

maven: Removing format file extension from created assembly

I've got a Maven2 project, where I use assembly plugin. Everything would be just fine if created assembly file name wouldn't ended with format extension (ex. ".zip"). I specified in plugin configuration a fileName parameter and setted appendAssemblyId to false. I have already spent few hours on that problem... Any idea?
My answer is a bit of a non-answer - don't remove the format extension. If you are using a specific <format> in your assembly descriptor to produce an artifact (zip, tar.gz, etc.) there is exists no good reason to remove the extension from the file. If I'm a user of your software and download this binary, I don't want to have to guess as to what the packaging type is, I should be able to tell just by looking at the filename.
FWIW, setting appendAssemblyId to false means that the <id> of your assembly descriptor will not be included in your file name.
Now, if you really are dead set on making this a pain for you and everyone else, what you probably want to do (as with most nonsensical things people want to make maven do) is to either use the antrun plugin to rename the generated file during your maven invocation, or just simply run a shell script to rename it after your maven process has finished.

Resources