Comments (5)
For now I have a workaround:
var assemblyLoader = Type.GetType("Costura.AssemblyLoader");
var assembliesAsResourcesFieldInfo = assemblyLoader.GetField("assemblyNames", BindingFlags.Static | BindingFlags.NonPublic);
var assembliesAsResources = (Dictionary<string, string>) assembliesAsResourcesFieldInfo.GetValue(null);
var symbolsAsResourcesFieldInfo = assemblyLoader.GetField("symbolNames", BindingFlags.Static | BindingFlags.NonPublic);
var symbolsAsResources = (Dictionary<string, string>)symbolsAsResourcesFieldInfo.GetValue(null);
var readFromEmbeddedResourcesMethodInfo = assemblyLoader.GetMethod("ReadFromEmbeddedResources", BindingFlags.Static | BindingFlags.NonPublic);
foreach (var assemblyKeyValuePair in assembliesAsResources)
{
Log.Debug("Forcing load from Costura packed assembly '{0}'", assemblyKeyValuePair.Key);
readFromEmbeddedResourcesMethodInfo.Invoke(null, new object[] { assembliesAsResources, symbolsAsResources, assemblyKeyValuePair.Key });
}
from costura.
Costura was designed to package dependencies into a single exe and automatically handle loading those assemblies as the program runs. Costura is designed to do this seamlessly and automatically.
What you're wanting to do is to manually do what Costura does automatically. I think in that case Costura is not the solution and you should implement your own form of dependency injection, which seems to be what you've done with the work-around.
from costura.
Costura does exactly what I need:
Pack assemblies which are normally being optimized away by the C# compiler. With IncludeAssemblies I can still force these assemblies to be included and then can extract them again if I have to. I don't understand why this is a "no-go". I can even send you a pull request ;-)
from costura.
If Costura does exactly what you need then there's no need for a PR.
Manual assembly loading is not the goal of Costura. Costura is for automatic assembly loading.
This has the same problem as issue #27, specifically how do you call into Costura? There would have to be a reference assembly added as a placeholder, and calls to that placeholder would have to be redirected as part of the code weaving.
Since you already have a functioning work-around I don't see why this extra code needs to be added to Costura, increasing it's complexity, when it's already a rather complex project.
from costura.
A good example is a type which you need during deserialization. The types are not directly used, but must be loaded in order to be used. Then you can discuss whether this must be handled by the serialization engine, but this is unfortunately not in my control. Preloading the assemblies with costura is.
I am just looking for a simple option:
costura loadAssembliesOnStartup="true" (false by default)
which just loops through the list of assemblies and loads them. I don't think that will make it over-complex.
from costura.
Related Issues (20)
- win32 dll [DllImport("helloword.dll")] OR [DllImport("helloword.so")] HOT 1
- Files not merging - "Package reference missing 'compile' part in IncludeAssets" HOT 1
- Once i install Costura.Fody to my project and then build.. windows defender catches my app.exe as a Trojan:Script/Wacatac.B!ml HOT 1
- An MSBuild Error that tells you nothing useful HOT 3
- Invalid attempt to merge ffmpeg DLL into C# exe,Has anyone tried that? HOT 1
- Unable to switch languages according to regional settings HOT 2
- Some users have crashes running on windows 7. HOT 1
- FileNotFoundException when using referenced assembly in x64 project HOT 4
- AutoCAD plug-in packaging is not supported HOT 2
- Language Resources Not Being Included HOT 4
- problem virus all virtualtotal. HOT 1
- The type initializer for 'Microsoft.Data.SqlClient.TdsParser' threw an exception HOT 12
- NET Framework 4.8 project: the bin\Release contains37 files. HOT 1
- i think <Costura IncludeDebugSymbols='false' /> disables the disable cleanup HOT 3
- Can't locate embedded satellite assembly HOT 5
- Fody.Costura on multi-target (.NET7 + .NET Framework 4.8.1) Class Library - Failure to Embed Dependencies HOT 4
- Make Unmanaged32Assemblies and Unmanaged64Assemblies works for Linux and macOS executables HOT 1
- Migrate to netStandart HOT 3
- I used Costura.Fody in my project to package it as a class library for others to call HOT 2
- Can support for C++/CLI be added? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from costura.