Déploiment WPF/WindowsForm et EntityFramework

Résolu/Fermé
InfinityUniYT Messages postés 51 Date d'inscription jeudi 6 septembre 2018 Statut Membre Dernière intervention 27 juin 2022 - 15 août 2021 à 22:32
Whismeril Messages postés 19029 Date d'inscription mardi 11 mars 2003 Statut Contributeur Dernière intervention 26 avril 2024 - 7 sept. 2021 à 14:21
Bonjour tout le monde !

Si je suis ici, c'est que j'ai un problème assez conséquent sur une application WPF (sinon WindowsForm ce serait encore mieux) qui concerne le déploiement de mon application.

Voila le problème:
Le programme déployé fonctionne sur l'ordinateur où je l'ai développé (il s'installe peux se lancer), mais il ne fonctionne pas sur n'importe quel autre ordinateur (il s'installe mais s'ouvre jamais quand on veut ouvrir l’application installée)

J'ai beau chercher sur internet aucune solution est valable. De plus dans mon application j'y ai ajouté un EntityFramework pour faire une BDD intégrée dans l'appli, es-ce que par hasard cela aurait un rapport?

Merci de vos futurs réponses.

11 réponses

Whismeril Messages postés 19029 Date d'inscription mardi 11 mars 2003 Statut Contributeur Dernière intervention 26 avril 2024 931
16 août 2021 à 19:04
Pouvez vous m'envoyer le lien de téléchargement du Framework en question (si possible)?

Ma boule de cristal est en panne, alors non je ne peux pas.... C'est toi qui sais pour quel framework tu as codé.....


es-t'il possible de faire en sorte le setup.exe du programme déployé installe un framework en même temps?

Oui si tu as la version professionnelle ou entreprise de visual studio.
1
InfinityUniYT Messages postés 51 Date d'inscription jeudi 6 septembre 2018 Statut Membre Dernière intervention 27 juin 2022 12
30 août 2021 à 18:19
Après de nombreux tests avec la même version et des versions différentes, le logiciel ne s'ouvre toujours pas une fois installé même avec le framework. Y aurait-il une autre solution à ce problème??
0
Whismeril Messages postés 19029 Date d'inscription mardi 11 mars 2003 Statut Contributeur Dernière intervention 26 avril 2024 931
3 sept. 2021 à 15:22
Dans programs.cs

        [STAThread]
        static void Main()
        {

            // hook on error before app really starts
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }

        static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            string bureau = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
            string log = Path.Combine(bureau, string.Format("Log_Erreurs_{0:yyyy-MM-dd_HH-mm-ss-fff}.txt",DateTime.Now));
            File.WriteAllText(log, e.ExceptionObject.ToString());
            Process.Start(log);
        }

1
Whismeril Messages postés 19029 Date d'inscription mardi 11 mars 2003 Statut Contributeur Dernière intervention 26 avril 2024 931
15 août 2021 à 23:08
Bonsoir

mais s'ouvre jamais quand on veut ouvrir l’application installée
c'est souvent le symptôme d'un problème de framework.

Le PC cible dispose t il bien de la framework pour laquelle ton logiciel a été écrit?
0
InfinityUniYT Messages postés 51 Date d'inscription jeudi 6 septembre 2018 Statut Membre Dernière intervention 27 juin 2022 12
16 août 2021 à 18:59
Possiblement, je n'y ai pas prêté attention. Pouvez vous m'envoyer le lien de téléchargement du Framework en question (si possible)?

Et si jamais les ordinateurs ont besoin d'un framework, es-t'il possible de faire en sorte le setup.exe du programme déployé installe un framework en même temps? Pour installer tout d'un coup sur n'importe quel pc
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
Whismeril Messages postés 19029 Date d'inscription mardi 11 mars 2003 Statut Contributeur Dernière intervention 26 avril 2024 931
30 août 2021 à 19:46
Tu codes avec quel langage? C#, VB.Net, etc....
0
InfinityUniYT Messages postés 51 Date d'inscription jeudi 6 septembre 2018 Statut Membre Dernière intervention 27 juin 2022 12
31 août 2021 à 15:35
Si je ne me trompe pas, le codage de l'application en question est en C#. Sa aurait une influence sur le développement?
0
Whismeril Messages postés 19029 Date d'inscription mardi 11 mars 2003 Statut Contributeur Dernière intervention 26 avril 2024 931
1 sept. 2021 à 10:19
Non normalement pas d'influence.
J'ai un bout de code qui permet d'intercepter des erreurs qui se produisent tout au début du lancement d'un logiciel. Autant te le fournir directement dans le bon langage.
Pour l'instant, je ne le trouves pas à la maison (j'ai celui pour winform, mais ça n'est pas exactement le même...) mais j'ai des dizaines de projets de tests qui servent au forum alors.... Au pire je le posterai lundi, car au travail, je sais dans quels projets je m'en suis servi.

0
Whismeril Messages postés 19029 Date d'inscription mardi 11 mars 2003 Statut Contributeur Dernière intervention 26 avril 2024 931
1 sept. 2021 à 10:59
Ha le voilà, à mettre dans app.xaml.cs
Attention
  • il n'intercepte pas tout
  • il flingue toute la gestion d'erreurs de ton projet, donc qu'il te permette ou pas de trouver ton problème, il ne doit pas rester dans ton projet après avoir essayé


    public partial class App : Application
    {
        protected override void OnStartup(StartupEventArgs e)
        {
            // hook on error before app really starts
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            base.OnStartup(e);
        }

        void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            // put your tracing or logging code here (I put a message box as an example)
            MessageBox.Show(e.ExceptionObject.ToString());
            File.AppendAllText("Erreurs.log", e.ExceptionObject.ToString());
        }
    }
0
InfinityUniYT Messages postés 51 Date d'inscription jeudi 6 septembre 2018 Statut Membre Dernière intervention 27 juin 2022 12 > Whismeril Messages postés 19029 Date d'inscription mardi 11 mars 2003 Statut Contributeur Dernière intervention 26 avril 2024
2 sept. 2021 à 11:55
Es-ce normal que je n'ai pas trouvé app.xaml.cs?
J'ai juste vu app.config qui a l'air de s'y rapprocher

Voila un aperçu de mes fichiers:
0
Whismeril Messages postés 19029 Date d'inscription mardi 11 mars 2003 Statut Contributeur Dernière intervention 26 avril 2024 931
2 sept. 2021 à 12:02
Ha c’est un projet winform…..

Bon je te posterai le bon code dans la soirée
0
Whismeril Messages postés 19029 Date d'inscription mardi 11 mars 2003 Statut Contributeur Dernière intervention 26 avril 2024 931
2 sept. 2021 à 12:03
Note quand même que tu as commencé ta question par
Si je suis ici, c'est que j'ai un problème assez conséquent sur une application WPF
0
InfinityUniYT Messages postés 51 Date d'inscription jeudi 6 septembre 2018 Statut Membre Dernière intervention 27 juin 2022 12 > Whismeril Messages postés 19029 Date d'inscription mardi 11 mars 2003 Statut Contributeur Dernière intervention 26 avril 2024
3 sept. 2021 à 14:27
J'ai pas fait attention je l’admit... Désolé pour cela ^^
0
InfinityUniYT Messages postés 51 Date d'inscription jeudi 6 septembre 2018 Statut Membre Dernière intervention 27 juin 2022 12
3 sept. 2021 à 15:54
Merci pour ton programme, voila ce que cela m'a affiché:
System.Data.Entity.Core.EntityException: Échec du fournisseur sous-jacent sur Open. ---> System.Data.SqlClient.SqlException: An attempt to attach an auto-named database for file D:\EntityDatasProgs\MemoireV2.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
à System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling, SqlAuthenticationProviderManager sqlAuthProviderManager)
à System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
à System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
à System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
à System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
à System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
à System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
à System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
à System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
à System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
à System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
à System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
à System.Data.SqlClient.SqlConnection.Open()
à System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.<Open>b__36(DbConnection t, DbConnectionInterceptionContext c)
à System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext](TTarget target, Action`2 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
à System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Open(DbConnection connection, DbInterceptionContext interceptionContext)
à System.Data.Entity.Core.EntityClient.EntityConnection.<Open>b__2()
à System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.<>c__DisplayClass1.<Execute>b__0()
à System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)
à System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(Action operation)
à System.Data.Entity.Core.EntityClient.EntityConnection.Open()
--- Fin de la trace de la pile d'exception interne ---
à System.Data.Entity.Core.EntityClient.EntityConnection.Open()
à System.Data.Entity.Core.Objects.ObjectContext.EnsureConnection(Boolean shouldMonitorTransactions)
à System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
à System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__5()
à System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)
à System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
à System.Data.Entity.Core.Objects.ObjectQuery`1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__0()
à System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()
à System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
à System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
à Memoire.F_Memoire.Affichage()
à Memoire.F_Memoire..ctor()
à Memoire.Program.Main()


D'après ce que je comprend, mon programme ne s'ouvre pas sur les autres pcs car ils ont besoin du .mdf à partir du quel j'ai généré mon EntityFramework.

Mais je me pose la question de : Es-t'il possible qu'il soit déjà intégré lors du déploiement? (Evitant de refaire les dossiers et tout pour qu'il le remette) Ou bien peut on donner un autre chemin d'accès pour que le programme atteigne le EF? (Comme par exemple le mettre avec les fichiers d'installation du logiciel)

Sinon dans les autres cas, je me contenterai d'essayer de refaire le chemin de base vers le EF sur mon autre pc pour voir si le programme tourne bien.
0
Whismeril Messages postés 19029 Date d'inscription mardi 11 mars 2003 Statut Contributeur Dernière intervention 26 avril 2024 931
3 sept. 2021 à 17:00
Je code pour mon propre usage, donc le déploiement je ne maîtrise pas.
Mais comme je te les déjà écrit plus haut, avec les version Professionnelle et Entreprise il y a des outils
0
InfinityUniYT Messages postés 51 Date d'inscription jeudi 6 septembre 2018 Statut Membre Dernière intervention 27 juin 2022 12
7 sept. 2021 à 12:29
Merci pour ton aide en tout cas, ton code d'identification d'erreurs m'a été très utile et c'est grâce à sa que j'ai trouvé solution à mon problème.

Pour le fait que le fichier .mdf soit intégré directement dans le développement, cela relève d'un autre sujet et sa ne sert à rien d'en discuter ici. J'estime donc ce post comme résolu.
0
Whismeril Messages postés 19029 Date d'inscription mardi 11 mars 2003 Statut Contributeur Dernière intervention 26 avril 2024 931
7 sept. 2021 à 14:21
Tant mieux
0