Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Unable to locate encrypted resource for assembly (MyAPP)

 
Post new topic   Reply to topic    Infralution Support Forum Index -> .NET Encryptor Support
View previous topic :: View next topic  
Author Message
panoramix



Joined: 06 Jul 2019
Posts: 4
Location: France

PostPosted: Fri Sep 27, 2019 9:27 pm    Post subject: Unable to locate encrypted resource for assembly (MyAPP) Reply with quote

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
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 4972

PostPosted: Mon Sep 30, 2019 10:51 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
panoramix



Joined: 06 Jul 2019
Posts: 4
Location: France

PostPosted: Mon Sep 30, 2019 11:43 pm    Post subject: Reply with quote

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
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 4972

PostPosted: Tue Oct 01, 2019 12:02 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
panoramix



Joined: 06 Jul 2019
Posts: 4
Location: France

PostPosted: Tue Oct 01, 2019 5:09 am    Post subject: Reply with quote

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
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 4972

PostPosted: Tue Oct 01, 2019 5:38 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> .NET Encryptor Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group