View previous topic :: View next topic |
Author |
Message |
panoramix
Joined: 06 Jul 2019 Posts: 4 Location: France
|
Posted: Fri Sep 27, 2019 9:27 pm Post subject: Unable to locate encrypted resource for assembly (MyAPP) |
|
|
Hello,
Evaluation of .Net Encryptor last version
I have this error when executing the bootstrap
--------------------------------------------------------
2019-09-27T21:21:10 1.0.0.0 Une erreur Bootstrap non gérée par l'application a été déclenchée :
Unable to locate encrypted resource for assembly (MyAPP)
System.IO.FileNotFoundException
Unable to locate encrypted resource for assembly (MyAPP)
AssemblyLoader4x86
Void ExecuteAssembly(System.Reflection.Assembly, System.String, System.String, System.String)
at AssemblyLoaderx86.AssemblyLoader.ExecuteAssembly(Assembly callingAssembly, String resourcePrefix, String resourceExt, String assemblyName)
at AssemblyLoaderx86.AssemblyLoader.ExecuteAssembly(String resourcePrefix, String assemblyName)
at Bootstrap.Program.ExecuteAssembly(String assemblyName) in C:\Users\toto\source\repos\Bootstrap\Program.cs:line 100
at Bootstrap.Program.Main(String[] args) in C:\Users\toto\source\repos\Bootstrap\Program.cs:line 30
--------------------------------------------------------
I did changed the bootstrap project as written on the support forum
My app is WPF net 4.8
with DocumentFormat.OpenXML and Ookii.Dialogs.Wpf, an image and icon include in the project
In the main window I use Assembly.GetEntryAssembly() to display info on the exe.
I added in App.config the 2.0 version as seen in the forum
<startup>
<supportedRuntime>
<supportedRuntime>
</startup>
----------------------------------------------------------------
The samples work
defender antivirus running
Windows 10 pro with the latest updates in a Parallel VM on my MacBook Pro 2017
What the Hell am I missing ???
Any help is welcome as I really want to solve this, I want to deliver my application with this solution as it seems to me the best solution without Problem with the client computers |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Mon Sep 30, 2019 10:51 am Post subject: |
|
|
This error means that the bootstrap program was not able to locate the an embedded resource called "MyApp" to load the encrypted application from . Have you added the encrypted version of your application executable to the bootstrap project as an embedded resource as described in the help (see below)?
Quote: | Next you need to add the Encrypted assemblies to your Visual Studio Bootstrap project as Embedded Resources. Enable the Visual Studio Project->Show All Files option. In the Solution Explorer window expand the Assemblies directory. Select each of your encrypted assembly files and use the right click Include in Project menu option to include the files in the project. Set the build action for the files to Embedded Resource.
|
Is your application actually called "MyApp"? If not you need to change the name passed to the ExecuteAssembly method in the bootstrap as described in the help:
Quote: | Finally change the Program.Main method in the bootstrap project so that it passes your main assembly name to the ExecuteAssembly method. Now you are ready to run your bootstrap application. |
_________________ Infralution Support |
|
Back to top |
|
|
panoramix
Joined: 06 Jul 2019 Posts: 4 Location: France
|
Posted: Mon Sep 30, 2019 11:43 pm Post subject: |
|
|
Thanks for the answer, effectively I forgot to embed the encrypted Assembly for the project.
Now the boostrap crash on the get of a Setting of my app:
---------------------------------------------------------------
at Syndemos.Properties.Settings.get_MoisRef() in C:\Users\toto\source\repos\SyndemosSLN\Syndemos\Properties\Settings.Designer.cs:line 78
Object reference not set to an instance of an object.
---------------------------------------------------------------
My only WPF window does a lot of two way binding with the default settings class
Is there a way to handèle this situation ?
Or a workaround ?
Thanks in advance for your answers |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Tue Oct 01, 2019 12:02 am Post subject: |
|
|
Can you email the Settings.Designer.cs code to support@infralution.com so that we can take a look at what is going on in that code. Normally settings should work without any issues with .NET Encryptor. _________________ Infralution Support |
|
Back to top |
|
|
panoramix
Joined: 06 Jul 2019 Posts: 4 Location: France
|
Posted: Tue Oct 01, 2019 5:09 am Post subject: |
|
|
Hello,
I solved the problem with this setting, for some unknown reasons I had to add a value, because it is empty the first time, the encrypted assembly always crashed:
Before
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public global::System.DateTime MoisRef {
get {
return ((global::System.DateTime)(this["MoisRef"])); //<-------------- this way always null on the first execution and trigged a null objet exception I didn't have when not encrypted
}
set {
this["MoisRef"] = value;
}
}
After:
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("2019-01-01")]
public global::System.DateTime MoisRef {
get {
return ((global::System.DateTime)(this["MoisRef"]));
}
set {
this["MoisRef"] = value;
}
}
Thank you very much for your prompt answers. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Tue Oct 01, 2019 5:38 am Post subject: |
|
|
The problem may have been that normally the default settings are read from the entry application config file (eg MyApp.exe.config). When you wrap use the bootstrap program it will be trying to load the settings (I think) from the bootstrap executable config settings (eg Bootstrap.exe.config). So you would need to copy the settings into this file - or use your solution so it does not need this. _________________ Infralution Support |
|
Back to top |
|
|
|