Changing the version information of ironpython .dll assembly - dll

I compiled a .dll file in ironpython, by using the following code:
import clr
clr.CompileModules('C:/example.dll', 'C:/example.py')
It essentially compiles the .py file to .dll.
The only problem with this is that it creates a file with no information about the Company, Language, File Version etc. In fact the File Version is always: 0.0.0.0.
I was wondering if there is a way to at least alter the File Version (change it to something other than 0.0.0.0). I googled and found a similar topic in here on stackoverflow.
I tried three methods:
1) One with Visual Studio (File->Open-> find .dll, Edit->Add Resource->Version click New. In the new Version tab, change FILEVERSION and PRODUCTVERSION)
2) Another one by using the Change version 2012 application
3) And third one by using: Simple Version Resource Tool for Windows 1.0.10
None of them worked.
For some reason looks like the structure of the .dll assembly created with ironpython is different than the .NET one created with VB or C#.
Does anyone know how to change the File Version from 0.0.0.0 to something else?
Thank you.

You can use the pyc.py file packaged into IronPython to compile your file into a .dll file. The file is located in the directory IronPython 2.7\Tools\Scripts.
If we open pyc.py for editing, you'll see the different things it can do.
pyc: The Command-Line Python Compiler
Usage: ipy.exe pyc.py [options] file [file ...]
Options:
/out:output_file Output file name (default is main_file.<extenstion>)
/target:dll Compile only into dll. Default
/target:exe Generate console executable stub for startup in addition to dll.
/target:winexe Generate windows executable stub for startup in addition to dll.
#<file> Specifies a response file to be parsed for input files and command line options (one per line)
/file_version:<version> Set the file/assembly version
/? /h This message
EXE/WinEXE specific options:
/main:main_file.py Main file of the project (module to be executed first)
/platform:x86 Compile for x86 only
/platform:x64 Compile for x64 only
/embed Embeds the generated DLL as a resource into the executable which is loaded at runtime
/standalone Embeds the IronPython assemblies into the stub executable.
/mta Set MTAThreadAttribute on Main instead of STAThreadAttribute, only valid for /target:winexe
/file_info_product:<name> Set product name in executable meta information
/file_info_product_version:<version> Set product version in executable meta information
/file_info_company:<name> Set company name in executable meta information
/file_info_copyright:<info> Set copyright information in executable meta information
/file_info_trademark:<info> Set trademark information in executable meta information
Example:
ipy.exe pyc.py /main:Program.py Form.py /target:winexe
One thing that I personally like to do is move pyc.py from the Scripts folder to the IronPython folder along with my python file as well.
Assuming you also do this, you would open command prompt as administrator and navigate to the IronPython folder.
cd "Program Files (x86)\IronPython 2.7"
Then you would want to compile your python file as a .dll and set the file version using pyc.py. To do that, you're going to want to type in:
ipy.exe pyc.py /main:example.py /target:dll /file_version:0.0.0.1
If you want to add a company name, and other items as well, you simply have to pass those option to the pyc.py script.
ipy.exe pyc.py /main:Program.py Form.py /target:winexe /file_info_company:Company

Related

SDL2_ttf can't find entry point unless libfreetype-6.dll is in proj folder

I am working with SDL2 and its add-on libraries SDL2_image and SDL2_ttf, using Visual Studio 2017. The libraries, and the .dll files that come with them, are in another folder (C:\SDL2.0\lib\x86), which is in the system path.
When I run, it fails, with this error message:
The procedure entry point InterlockedCompareExchange#12 could not be located in the dynamic link library C:\SDL2.0\lib\x86\SDL2.ttf.dll.
I can fix this by putting libfreetype-6.dll, which comes with SDL2_ttf, in the same folder as the .vcxproj file; or in the Debug folder. I can also fix it by putting the .dll into c:\windows\SysWOW64. But I want to distribute my code, and I don't want to put that file in each folder or require users to have admin access (to access c:\windows\SysWOW64); I want Windows to find it in the PATH, as it does with the other .dll files it's using here.
A few things I tried as I looked around the web for solution (to no effect):
Recompiling libfreetype-6.dll
Downloading the latest versions of all associated libraries
Rearranging the .lib files in Project Properties, Linker, Input, Additional Dependencies. Admittedly I may not have tried all possible arrangements as there are several dependencies
regsvr32 libfreetype-6.dll. This led to a different error message:
The module "libfreetype-6.dll" may not be compatible with the version of Windows that you're running. Check if the module is compatible with an x86 (32-bit) or x64 (64-bit) version of regsvr32.exe.
I saw here that maybe I should use the version of regsvr32 in the system32 folder; when I do that, I get
The module "libfreetype-6.dll" was loaded but the entry-point DllRegisterServer was not found. Make sure that "libfreetype-6.dll" is a valid DLL or OCX file and then try again.
So: is there a way to get the program to find libfreetype-6.dll in another folder in the PATH, and eliminate the error message about the procedure entry point?
The program I'm testing on now is from the TrueType tutorial from the LazyFoo website (source).

How to use MSBuild.ExtensionPack

I have to run two targets in parallel to profile iisexpress.exe using OpenCover.
The link below relates to the information about the issue I am having.
https://github.com/sawilde/opencover/issues/92#issuecomment-5143204
This suggested to me to use Msbuild.ExtensionPack from CodePlex.
I have downloaded the source code of MSBuild Extensions.
I compiled it. I copied the MSBuild.ExtensionPack.tasks tasks file in to folder BuildBinaries.
I added the below lines in my projects files.
I was trying to run the ExecMultipleTasks target. But getting the below error.
error MSB4036: The "MSBuild.ExtensionPack.Framework.Parallel" task was not found. Check the following:
1.) The name of the task in the project file is the same as the name of the task class.
2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface.
3.) The task is correctly declared with in the project file, or in the *.tasks files located in the "C:\Windows\Microsoft.NET\Framework\v4.0.30319" directory.
Could you please let me know how to fix this issue?
Thanks,
Venkat.
which version of visual studio your application is using ?, if its 32 bit of VS then install 32 bit Extension Pack (MSBuild.Extension.Pack.4.0.12.0.zip\4.0.12.0\x86) else go for 64 bit.
If you open up the file C:\Program Files (x86)\MSBuild\ExtensionPack\4.0\MSBuild.ExtensionPack.tasks ill think you find that the path to the dll for the task MSBuild.ExtensionPack.Framework.Parallel is not correct.
<UsingTask AssemblyFile="$(ExtensionTasksPath)MSBuild.ExtensionPack.dll" TaskName="MSBuild.ExtensionPack.Framework.Parallel"/>
I imagine the variable $(ExtensionTasksPath) does not locate your build path for your version. Either copy the files into that path or change/hardcode the new path.

Adding a .dll to a NetBeans 7.0 C project. Unable to view .dll

I am trying to read a .wav file and hence need to include the libsndfile binary in my project. I am using NetBeans 7.0 and the Tools->Library->Add new library option doesnt work since the Add library button is disabled.
I tried adding the path of the header file to the Project->Build properties and the code compiled. But when I try to add the .dll in a similar way via Project->Linker properties NetBeans is unable to find the .dll. If i navigate to the folder from MyComputer->..i can see the .dll/ However NetBeans doesn't display it.
I am using a Win 7 64 bit machine & I have setup the appropriate libsndfile binary. Been at it for a day now. Would appreciate any help.
Thanks,
Neeraj
DLL doesnotrequires setting of class path. So you can load a DLL from local file system. Copy the DLL and go to the file explorer tab strip and paste the file.
First you have to check that your compiler version (32 or 64 bit) matches libsndfile version. I suppose you did it correctly.
I also suppose you correctly added the sndfile.h to the include path.
You will need two library files actually. I think you forgot the one to compile properly.
Compiling and Linking (.lib file)
Note that Netbeans 7.0 doesn't accept .lib files and you need to link the .lib file for your project to compile. So, in C:\Program Files\Mega-Nerd\libsndfile\lib you need to copy libsndfile-1.lib and rename the .lib extension to .a.
Then, in Poject Properties > Build > Linker > Additional Libraries Directories add the path to the \lib directory. For me it's Program Files/Mega-Nerd/libsndfile/lib.
A few lines below, you'll have Poject Properties > Build > Linker > Libraries. Specify the location of the library file named libsndfile-1.a, for me it's C:\Program Files\Mega-Nerd\libsndfile\lib\libsndfile-1.a.
Now it should at least compile.
Executing (.dll)
Now, it likely will not execute even if it compiled. That's because the .dll file is needed to execute the final .exe. Simply copy the libsndfile-1.dll file (for me it's in C:\Program Files\Mega-Nerd\libsndfile\bin) to your project, next to the .exe file. For me, it's in C:\proj\dist\Debug\Cygwin-Windows\proj.exe.
Edit: I checked with the today's 8.2 version of NetBeans, and the procedure is exactly the same.

Deploy SL4 application with localized DLL imports

I have a VS2010 SL4 project which uses an external Silverlight DLL. The project is localized with multiple RESX files, and the DLL is, too. I usually include external DLLs in my solutions as follows:
1) create a set of virtual folders in my solution like (say the imported DLL is named Sample.dll):
/Lib/Sample/Debug
/Lib/Sample/Release
2) create the same folders structure in the file system and copy under Debug and Release the respective versions of the DLL, so that now I find the following files:
/Lib/Sample/Debug/Sample.dll
/Lib/Sample/Release/Sample.dll
3) add to all the client projects in the solution a reference to /Lib/Sample/Debug/Sample.dll.
4) open the .csproj file of each project with the added reference, and change the Debug part of the path with $(Configuration), so that the right Debug/Release version is picked during build.
Now the question is: in my SL4 solution I can follow the same procedure for importing the language-neutral DLL. But what about its satellite resources? For instance, the French version of the imported DLL is built under subfolder fr-FR and named Sample.resources.dll. How should I include it correctly? Even If I try to manually add it in the compiled XAP under folder fr, it is ignored and the application falls back to its neutral culture...
I think I found it, here's a recap for whom may be interested:
open the .csproj file and ensure you add all your desired languages (separated by semicolons) in . For instance, if you support fr-Fr add <SupportedCultures>fr-Fr</SupportedCultures>.
(had to do this manually, I supposed 1. should be enough): once compiled, open your xap (rename it to .zip and open) and add if not present an element like <AssemblyPart Source="fr-FR/Sample.resources.dll" /> for each imported satellite with resources.
Thanks anyway!

Create self extracting archive with autorun on linux for windows platform

Our application is distributed as a zip file, with a small bat/shell script that the user runs after extracting the archive to install the application. This zip file is currently created via mavens assembly plugin.
The zip file we distribute contains a lib folder with an executable jar, as well as all the files we need as part off the deployment off the actual application.
What we want is a self extracting zip-file that executes that contained bat file after the zip file has been extracted. And this should be created as a part off the build process.
I have read creating-a-self-extracting-zip-archive-on-a-linux-box, and can do that. But I don't see anywhere how to also execute a bat file within the extracted archive when it's done.
I have found winzip self-extractor, but I would prefer something that can be run on any platform. The build server and some developers use linux. I also found some VB code which leads me to believe that there might be some autorun properties on zip files.
Did you consider using IzPack (and the IzPack Maven Plugin) to generate a cross-platform installer?
The previous replier suggested lzpack, it's documentation contains the following pointer:
""The 7-Zip project (see http://www.7-zip.org/) provides a so-called SFX for installers, i.e., an image that can be use to create self-extracting Windows executables. Once its content has been extracted, such a self-extracting executable can launch an executable or a file. In the later case, it is assumed that there exists an association between a file extension and a software component.""
7-zip is cross platform, although I haven't tried whether you can build sfx files for windows on linux.
The 7zip manpage says you can do this.
EXAMPLE 2
7z a -sfx archive.exe dir1
add all files from directory "dir1" to SFX archive
archive.exe (Remark : SFX archive MUST end with
".exe")
While it's a bit late:
We just released a Maven plugin that can do this (docs at https://zephyr.sunshower.io/site/). It's free, open-source, and permissively licensed.
We bundle a JRE with our application using this plugin, then launch an IzPack installer with that JRE. It also supports code-signing, which we expect to have documented within the week.