ILRepack exe doesn't locate xaml file - wpf

I have a WPF exe I want to merge with its referenced libraries, so I tried ILRepack. The merging is done fine and the final executable is pretty fat.
But when I try to launch it, it stop to work, and when I debug in Visual Studio I get an "IOException - Cannot locate resource 'mainwinwows.xaml'" (the original message is in french, the translation might be not very accurate). The StartupUri is correct.
Here is my command line:
ILRepack.exe "C:\<Some path>\originalExe.exe" /lib:"C:\<Some path>\libsToInclude" /out:"C:\<Some path>\finalExe.exe" /log:"C:\<Some path>\logBuild.log" /target:winexe
Should I merge the xaml file with the other libraries ?

Related

How to automatically include a copy of resource files when compiling without embedding them?

I have the following XAML code:
<dxm:MapPolygon EnableHighlighting="False">
<dxm:MapPolygon.StrokeStyle>
<dxm:StrokeStyle Thickness="0"/>
</dxm:MapPolygon.StrokeStyle>
<dxm:MapPolygon.Fill>
<ImageBrush ImageSource="ShapeFiles\Piran\B010262.tif"/>
</dxm:MapPolygon.Fill>
<dxm:MapPolygon.Points>
<dxm:GeoPoint Latitude="45.4922488128447995" Longitude="13.6751748869624681" />
<dxm:GeoPoint Latitude="45.4922488128447995" Longitude="13.7045866089215824" />
<dxm:GeoPoint Latitude="45.5195646122025437" Longitude="13.7045866089215824" />
<dxm:GeoPoint Latitude="45.5195646122025437" Longitude="13.6751748869624681" />
</dxm:MapPolygon.Points>
</dxm:MapPolygon>
This used to generate a ShapeFiles/Piran/B010262.tif folder next to the .exe file in the release folder, but now I get system.windows.baml2006.typeconvertermarkupextension exception instead.
If I add the files as a resource, they get embedded into the .exe file and I end up with a 600MB exe, which I do not want, because I want the users to be able to update the .tif files even without source code.
If I include the full path, for example ImageSource="c:\ShapeFiles\Piran\B010262.tif"/>, the program will compile just fine, but then I am bound to that location.
How do I add files as a resource without embedding them into an exe file?
Select the files that you want to exclude from embedding.
Properties > Build Action: Content
Properties > Copy to Output Directory: Copy always
Also, be sure to delete the obj\Release directory before compiling, otherwise the files might still get embedded into the exe.
Source: https://learn.microsoft.com/en-us/dotnet/desktop/wpf/app-development/wpf-application-resource-content-and-data-files?view=netframeworkdesktop-4.8#:~:text=Resource%20Files%3A%20Data%20files%20that,with%20an%20executable%20WPF%20assembly

CodeBlocks - How to add an icon to a C program?

I have a small C console program and I want to add an .ico file to it, so that the executable looks nice.
How can I do this in CodeBlocks with MinGW/gcc?
I could not find relevant help via google that a total beginner (like me for C) could follow, so I will Q&A this topic.
First of all you need an .ico file. Put it in the folder with your main.c file.
In CodeBlocks go to File -> New -> Empty File and name it icon.rc. It has to be visible in the Workspace/Project otherwise CodeBlocks will not be aware of this file. It will show up there in a project folder called Resources .
Put the following line in it: MAINICON ICON "filename.ico". MAINICON is just an identifier, you can choose something different. More info 1 & More info 2.
Save the files and compile - CodeBlocks will do everything else for you
What will happen now, is windres.exe (the Resource Compiler) compiling the resource script icon.rc and the icon to an object binary file to obj\Release\icon.res. And the linker will add it to the executable.
It's so easy yet it took me quite a while to find it out - I hope I can save someone else having the same problem some time.

wpf localization - locbaml - file is being used by another process

I have been looking hours for a solution, but I donĀ“t find it.
I want to generate a satellite assembly with following command.
locbaml.exe /generate de/App.UI.resources.dll /trans:MeineRess_de.csv /out:de /cul:de
After executing I get following error:
The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020)
Can anybody help me, Thx
Output to a separate folder try for example c:\ this would work
locbaml.exe /generate de/App.UI.resources.dll /trans:MeineRess_de.csv /out:c:\ /cul:de
For posterity:
The file name without any command line flag is the original input assembly. So you're reading in de/App.UI.resources.dll and then /out:de is trying to write to the same file in the same folder.
Probably you want to change de/App.UI.resources.dll to [UiCulture]/App.UI.resources.dll where [UiCulture] is the <UICulture> from your project file, which should match the NeutralResourcesLanguage attribute in your assembly (AssemblyInfo.cs normally).
Perhaps you legitimately want to overwrite the original DLL (though I don't think that makes sense), but this will not be possible as-is because locbaml will load the assembly from file, which holds the file handle open until the application exits. (Technically until the AppDomain is destroyed.)

How can I fix my invalid resx file input?

I added several existing files (from a VS 2008 Windows CE project) to a VS 2008 Winforms project. For many (but not all) of the forms, I get this err re: the *.resx files:
Invalid Resx file. ResX input is not valid. Cannot find valid "resheader" tags for the ResX reader and writer type names.
The *.resx files that are fine display like so when I 2-click them in the Solution Explorer:
...whereas those that won't compile with the err msg above display one thing if I 2-click the *.resx file in the Solution Explorer, to wit:
...but the error-invoking *.resx files show their code if I 2-click the line in the Error List, like so:
. . .
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
. . .
Note: The solution here C# resx file error: doesn't seem to apply to my situation, as the out-of-kilter / off-the-rails files already have this format:
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
Why are some resx files fine while the others prevent compilation? How can I massage/tweak them to get past the compile gauntlet?
I'm a little surprised that you can have the $ sign in the resource name.

Compaq Visual Fortran - Crashes During Linking A .LIB File

When I compile with Compaq Visual Fortran, I get these errors (when it starts the linker process) that should be located in a .lib file I thought I added to the workspace:
X30XFULL.OBJ : error LNK2001: unresolved external symbol _BCON#4
X30XFULL.OBJ : error LNK2001: unresolved external symbol _RCON#16
According to where I've googled about, it looks like Compaq Visual Fortran (Version 6, FYI) can't find the library files...
My main question is, how do I use them? Could there possibly be other missing files? Here is what I've tried:
Right Click->Adding the files in the FileView window
Going under Project->Settings, Clicking the Link tab, and under the input category, adding the library files under object/library modules (bprop.lib rprop.lib) and having the Additional Library Path point to where the files are. I also did this under the Resources tab and where it says "Additional Resource Include Directories," I put the directory of where these files were located.
To cover my bases, I also put these files in where the project workspace file, where the compiled executable file would be generated, and pretty much any place I could think of that CVF might possibly look to in order to find these files.
A little background:
I have this Fortran executable that was last compiled in the 90s. From my research, it's a 16-bit compiled one which won't work on a 64-bit machine.
The original code has, at least from what we can gather, 16 bit compiled libraries. Without the original compiler, we can't figure out how to look at or use them. We also have a (semi)equivalent library file that's actually a .FOR file. For all we know, the BPROP.FOR and BPROP.LIB could be the same file (they were found in the same source code area). If we use the BPROP.FOR file, the program can compile, but we are having issues with results that we've traced down to information that is used/gathered/processed in that file.
However, we do have 32-bit versions of (what we think) are the same .lib files. So, we're trying to use that, which is what is being used to compile the Fortran executable which results in the errors above.
Found the answer, at least for me. I don't know how easy it'll be to extrapolate if anyone else finds these answers, but this is how I solved it.
With the old Fortran libraries, all I had to do was add them to the FileList view that has all of the different fortran files (.FOR, etc). I did not have to add these libraries in the settings like I mentioned, but that will work as well. Other then that, I didn't need to add any extra declarations or anything similar.
What we did find out is that the function in question (BCON and RCON) that calls those .LIB files required an additional argument. The only way I found this out was examining other source code that used those libaries, so if anyone is stuck like I was, that would be a good place to start. Alternatively, if you can read the .lib file in a hex editor, you can kind of make out functions and their arguments.
Of course, if you have the original source code for said arguments, that's even better. :)

Resources