Click here to Skip to main content
15,914,013 members
Home / Discussions / C#
   

C#

 
GeneralRe: Access WebApi remotely - C'mon guys I don't believe no one has a clue ! any hint will do Pin
pkfox27-Apr-20 4:54
professionalpkfox27-Apr-20 4:54 
GeneralRe: Access WebApi remotely - C'mon guys I don't believe no one has a clue ! any hint will do Pin
Peter Shaw27-Apr-20 14:05
professionalPeter Shaw27-Apr-20 14:05 
GeneralRe: Access WebApi remotely - C'mon guys I don't believe no one has a clue ! any hint will do Pin
pkfox28-Apr-20 1:23
professionalpkfox28-Apr-20 1:23 
QuestionHow to read .dbc file in C#? Pin
Member 1480752420-Apr-20 1:06
Member 1480752420-Apr-20 1:06 
AnswerRe: How to read .dbc file in C#? Pin
Pete O'Hanlon20-Apr-20 1:23
mvePete O'Hanlon20-Apr-20 1:23 
GeneralRe: How to read .dbc file in C#? Pin
#realJSOP20-Apr-20 2:11
professional#realJSOP20-Apr-20 2:11 
GeneralRe: How to read .dbc file in C#? Pin
Peter Shaw22-Apr-20 12:14
professionalPeter Shaw22-Apr-20 12:14 
AnswerRe: How to read .dbc file in C#? Pin
Gerry Schmitz20-Apr-20 11:26
mveGerry Schmitz20-Apr-20 11:26 
AnswerRe: How to read .dbc file in C#? Pin
Matt Slay24-Apr-20 16:33
Matt Slay24-Apr-20 16:33 
QuestionObject Tracking With A Web Cam Pin
Kevin Marois19-Apr-20 10:19
professionalKevin Marois19-Apr-20 10:19 
QuestionObject Tracking With A Web Cam Pin
Kevin Marois19-Apr-20 10:19
professionalKevin Marois19-Apr-20 10:19 
AnswerRe: Object Tracking With A Web Cam Pin
Pete O'Hanlon19-Apr-20 21:26
mvePete O'Hanlon19-Apr-20 21:26 
GeneralRe: Object Tracking With A Web Cam Pin
Kevin Marois20-Apr-20 6:03
professionalKevin Marois20-Apr-20 6:03 
GeneralRe: Object Tracking With A Web Cam Pin
Kevin Marois20-Apr-20 8:44
professionalKevin Marois20-Apr-20 8:44 
GeneralRe: Object Tracking With A Web Cam Pin
Pete O'Hanlon20-Apr-20 10:55
mvePete O'Hanlon20-Apr-20 10:55 
QuestionMake a single exe application - costura.fody - AppDomain.CurrentDomain.AssemblyResolve Pin
andla119-Apr-20 8:19
andla119-Apr-20 8:19 
I have tried many things before I found costura.fody and I were hoping that would be the solution to create a single file exe of a cefsharp application that I'm doing.

So the help file for costura.fody says to set the copy local to true of the file you want to embed in the solution explorer. Done that.

So the exe got a little bit bigger when I did that but I notice that the size was not even close to cover libcef.dll so I suspected that this file was not embedded.

I tested this by renaming the dll in the output folder and yes I couldn't run the application.

I would really love for this to work but I'm kind of giving up. I was struggling with AppDomain.CurrentDomain.AssemblyResolve to tap into that event but it was never called. Even when defining it in the static constructor to make sure it is started before anything else.
I'm currently using this code:

C#
[STAThread]
public static void Main(string[] args)
{
    AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(ResolveAssembly);
}


Just to clarify things, I'm using a windows forms project and I'm trying to make it as close to the examples I can find online. I would prefer to just add it in the Form1 constructor.
It should be calling this function
C#
private static Assembly ResolveAssembly(object sender, ResolveEventArgs args)
{
    throw new NotImplementedException();
}


But it never does.

In the .csproj file tried this snippet.

<Target Name="Prebuild">
   <CallTarget Targets="Clean" />
   <MSBuild Projects="$(SolutionPath)" Targets="Build" Properties="Configuration=Debug;IgnoreRecursion=true" />
 </Target>
 <Target Name="BeforeBuild">
   <ItemGroup>
     <_IgnoreRecursion Include="$(IgnoreRecursion)"/>
   </ItemGroup>
   <CallTarget Targets="Prebuild" Condition="'%(_IgnoreRecursion.Identity)' != 'true'" />
   <CreateItem Include="$(TargetDir)\**\*.*">
     <Output TaskParameter="Include" ItemName="OutputFiles" />
   </CreateItem>
   <ItemGroup>
     <EmbeddedResource Include="@(OutputFiles)" Condition="('%(OutputFiles.Extension)' == '.dll' Or '%(OutputFiles.Extension)' == '.pdb')">
       <LogicalName>%(OutputFiles.DestinationSubDirectory)%(OutputFiles.Filename)%(OutputFiles.Extension)</LogicalName>
     </EmbeddedResource>
   </ItemGroup>
   <Message Importance="high" Text="Embedding: @(OutputFiles->'%(Filename)%(Extension)', ', ')" />
 </Target>


This embeds the dll's fine. I just wish ResolveAssembly could be called. If it was I could have this code taking care of the lost dll's
//static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
//{
//    return null;
//    //var currentAssembly = Assembly.GetExecutingAssembly();
//    //var requiredDllName = $"{(new AssemblyName(args.Name)).Name}.dll";
//    //var resource = currentAssembly.GetManifestResourceNames().Where(s => s.EndsWith(requiredDllName)).FirstOrDefault();
//    //if (resource != null)
//    //{
//    //    using (var stream = currentAssembly.GetManifestResourceStream(resource))
//    //    {
//    //        if (stream == null)
//    //        {
//    //            return null;
//    //        }
//    //        var block = new byte[stream.Length];
//    //        stream.Read(block, 0, block.Length);
//    //        return Assembly.Load(block);
//    //    }
//    //}
//    //else
//    //{
//    //    return null;
//    //}
//}



Can anyone please help me with this?

Kind regards andla
AnswerRe: Make a single exe application - costura.fody - AppDomain.CurrentDomain.AssemblyResolve Pin
Richard MacCutchan19-Apr-20 21:54
mveRichard MacCutchan19-Apr-20 21:54 
GeneralRe: Make a single exe application - costura.fody - AppDomain.CurrentDomain.AssemblyResolve Pin
andla120-Apr-20 6:23
andla120-Apr-20 6:23 
GeneralRe: Make a single exe application - costura.fody - AppDomain.CurrentDomain.AssemblyResolve Pin
Dave Kreskowiak20-Apr-20 8:35
mveDave Kreskowiak20-Apr-20 8:35 
GeneralRe: Make a single exe application - costura.fody - AppDomain.CurrentDomain.AssemblyResolve Pin
andla121-Apr-20 3:33
andla121-Apr-20 3:33 
GeneralRe: Make a single exe application - costura.fody - AppDomain.CurrentDomain.AssemblyResolve Pin
andla121-Apr-20 3:46
andla121-Apr-20 3:46 
GeneralRe: Make a single exe application - costura.fody - AppDomain.CurrentDomain.AssemblyResolve Pin
Dave Kreskowiak21-Apr-20 4:03
mveDave Kreskowiak21-Apr-20 4:03 
QuestionRestSharp poser Pin
pkfox18-Apr-20 8:57
professionalpkfox18-Apr-20 8:57 
AnswerRe: RestSharp poser Pin
Gerry Schmitz18-Apr-20 11:04
mveGerry Schmitz18-Apr-20 11:04 
GeneralRe: RestSharp poser Pin
pkfox18-Apr-20 22:00
professionalpkfox18-Apr-20 22:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.