I've tried almost everything found on the net to solve this problem, but it just seems to not work!
I created a .exe file from a visual studio 2013 project using wpf. I want this file to create pdfs, so I added as references .dlls concerning itextsharp.
Everything works fine if I keep my .exe file in the same directory as itextsharp's .dlls. But when I try to run the .exe outside, the program crashes.
I've tried to use ILMerge, I read it is pretty good to merge .exe and .dll, but when I double-click one the newly-created .exe file nothing happens.
The command I wrote in my command window, once in the ILMerge folder, was:
ilmerge C:\Users\Utente\Desktop\PDFWriter.exe C:\Users\Utente\Desktop\itextsharp.dll /out:C:\Users\Utente\Desktop\merged.exe /target:winexe /targetplatform:"v4,C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5"
Thanks for your help!
Use Fody.Cosura project for merging. A lot nice to work with than ILMerge.
All you need to do is to install nuget package in your project:
PM> Install-Package Costura.Fody
And you are pretty much done. You can adjust the configuration, but that is not always required as just installing the package does the bulk for you.
Related
I need some help using CodeAnalysisCSharp in my VSIX project.
The issue I'm currently having is that the necessary dlls are not "deployed" when installing the extension. I've had to manually copy/paste these files to the C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE folder, for it to "work".
System.Numerics.Vectors.dll
System.Runtime.CompilerServices.Unsafe.dll
System.Memory.dll
Microsoft.CodeAnalysis.dll
Microsoft.CodeAnalysis.CSharp.dll
I have created an extension project and added a custom command. This command should be able to use the CodeAnalysisCSharp to navigate the syntax tree of a C# file.
I'd very much like for the installer file (.vsix) to be able to deploy the dll dependencies, just like you'd expect it to, I just don't know how or where to look to make this happen.
Thanks in advance.
I found out that if you use the vsixmanifest file to add assets, and give it a sub folder, it doesn't get packaged correctlty. The files will be copied correctly, but the reference to the dlls are not correct, so you get a "dll not found" exception.
In general the vsixmanifest designer, seems to be riddled with quirks where you need to edit the xml code to be sure that the values are set correctly.
Met a problem. VS2013 doesnt allow to merge files into same exe which created after build.
"$(SolutionDir)ILMerge\ILMerge.exe" "$(TargetPath)" "$(SolutionDir)..\Lib\Soft.dll" /out:"$(TargetPath)"
My idea was to merge built exe with 1 dll (uses in references) and to have the same exe filename.
I can do this without any problem apart of VisualStudio.
But i prefer to do merge exactly in post-build event, and do not change the exe filename.
Is there some workaround ?
PS. I dont want to have a dll in resources, because its used a lot, and its easy to have as usual in references
I want to build my solution file using MSBuild but there is one issue. My MSBuild file is located at C:\WINDOWS\Microsoft.NET\Framework\v3.5\. So now only if I have my entire solution and projects files in this path am I able to compile the solution. But I cant keep having all my solution and project files in C:\WINDOWS\Microsoft.NET\Framework\v3.5\. The location of my solution files maybe at any location in my pc or in TFS, and I'll have to use MSBuild to compile it.
I saw in some forum that I'll have to change the path in regedit in the location
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\3.5, but then it still remains static. If I want to execute a solution file which is in TFS then I'll have to again change the path in regedit.
Is there any alternative to this?
The msbuild.exe is there on my system, too. That is perfectly fine, as it's the task of VS or build tools to handle that. Normally you would either run a build script with C:\WINDOWS\Microsoft.NET\Framework\v3.5\ in the path environment, or your build solution knows where to find it. Usually, the msbuild.exe has to be changed only when you retarget to a different framework version (say 4.0). For building on a clean machine, the prerequisites should be set up correctly. So there should be no need to include msbuild.exe in your repository. Probably this would be considered bad practice. Do you have any reason, why you want to have the msbuild.exe versioned?
I have a relatively complex console application which relies on several dlls. I would like to "ship" this in the best form. My preferred way would be an exe file with all dependencies embedded in it (not that big, about 800K). Another thing would be to just zip the contents of the "Debug" folder and make that available, but I'm not sure if everything will be available like that (will all dependencies be resolved just by zipping the debug folder?)
What reliable practices exist for deploying console apps written in C# using VisualStudio 2008?
If you just copy the Foo.exe, dlls and Foo.exe.config files, it's likely to be okay. Have a look at what else is in the debug folder though - you (probably) don't want to ship the .pdb files, or Foo.vshost.exe. Is there anything else? If you've got any items marked as Content which are copied to the output folder, you'll need those too.
You could use ilmerge to put all the dependencies into one exe file, but I'm somewhat leery of that approach - I'd stick with exe + dependency dlls.
You should look into setup projects in Visual Studio. They let you set up dependencies and include the DLLs you need. The end result is a setup.exe and an MSI installer.
Here's a walkthrough that should help.
OR you could use a self-extracting ZIP file. Package all the normal files up - .exe, .dll, .config, and anything else - into a zip file. Extract into a temp directory and set the run-on-extract program to be the actual console exe.
Create a setup project in VS08 and add the primary output of the console app project to it, this resolves the dependencies and packages them in a .msi
You can use wix installers to bundle it. For console application, exe + dependicies DLLs + nuget DLLs , zipping them is enough.
I need to generate a list of all the files which are enough to run my application on any machine. I need this for a setup program. When i go to bin/release folder i'm able to see some pdb files and some configuration files, which i think will not be needed. I tried to disable generation of pdb files too but it still generates pdb for the other projects present in the solution.
So i need a way in visual studio 2008, which can get me all the files (the .exe and .dll and other files) required by my application to run.
Thanks.
Have you tried publishing the application (Build > Publish [app])?
This should just copy all the essential files to the specified folder.
The pdb files are used for debugging. Building in "Release" mode should exclude these files.
You can also create a setup project within the solution. Using that project it is possible to see a list of included files.
If you make a release build or publish the application then you should have a complete set of assemblies your application needs.
However, it can still rely on assemblies which reside in the GAC (Global Assembly Cache) of your machine. Check the references of your project if you think there are assemblies missing in the bin folder.
To solve this exact problem with our software, we wrote a simple console app that finds all the .vbproj & .csproj files in our projects directory, then changes all of the to Release mode (which does not create pdb files, documentation files etc).
This is then run by the build machine (CruiseControl.Net) before it starts compiling the projects.