The application requires the assembly ... to be installed in global assembly cache
Asked Answered
G

4

9

I have created an window application using C#. I am publishing the application which is successful.

When I am trying to install the application it is showing the below error.enter image description here

I am seen some solution which is about setting the project which automatically the same as below

enter image description here

I don't want to put the dll's in GAC.

Any suggestion or solution for this.

I have gone through the following urls

Error message "Unable to install or run the application. The application requires stdole Version 7.0.3300.0 in the GAC"
Unable to install or run the application: Click Once

Giamo answered 11/3, 2016 at 10:18 Comment(8)
What do you mean by "install the application". have you created installers? Are you using something like Wix?Blandishments
@NathanCooper I have created an installer from publishing the application which I have created.Mixtec
r u using the report viewerUtu
@TanmayNehete no it's a setup have single window form. And two dlls.Mixtec
@Giamo are you trying to run this application in same machine where it generted the executable file? if not did you tried to import that dll along with that executable file to another machine?Dovetail
@Webruster I am trying on the same machine.Mixtec
@Giamo did you set this config In Solution Explorer, expand the References node and click the assembly listed in the error. Ensure Copy Local in the Properties grid is set to ‘True’.Dovetail
@Webruster it is all ready true.Mixtec
L
6

It is a ClickOnce error message, it is telling you that it cannot locate the JamaaTech.Smpp.Client.Net.Lib.v1.4.dll assembly. This is a particularly clumsy error message, you of course never want to use the GAC in ClickOnce. And it doesn't tell you about the real problem, you don't stand a chance to diagnose the problem. You know that the assembly is present, you definitely included it in the deployment package, so why can't it find it?

There is another reason why an assembly can't be loaded beyond the file simply not being present. It will also fail when the wrong version of the assembly is present. In other words, the [AssemblyVersion] of the assembly does not match the one you compiled your program with.

Looking at the attribute declaration in the library shows:

[assembly: AssemblyVersion("1.4.3.*")]
[assembly: AssemblyFileVersion("1.4.3.1")]

Note the * in the attribute. This is a horribly bad idea. Looks like the author likes semantic versioning but doesn't trust it enough to correctly track changes to the project. The * gets substituted at build-time by a seemingly random number, 21129 in your case. It is not that random, it is derived from the time of day. The number of seconds / 2 since midnight. You can deduce from the poor error message that it wants the one that was built at 11:44:18 in the morning and probably found another one.

What is likely to go wrong with this approach are the two references in your WindowsFormsApplication1 project. You are pretty likely to have added the Debug build of these assemblies as references. Which all works fine, you never noticed a problem when you debugged your app. But when you build the Release version of your app, like ClickOnce publishing will do, you'll now have a version mismatch, the Release build of these assemblies have a randomly different version number and will not match the version of the reference assembly.

Two basic ways to fix this problem, I recommend you use both:

  • Get rid of the horrid random number generator and edit the [AssemblyVersion] attribute. There are two, one in the JamaaTech.SMPP.Net.Lib/Properties/AssemblyInfo.cs source file and another in the JamaaTech.SMPP.Net.Lib/Properties/AssemblyInfo.cs source file. Just make them the same as the [AssemblyFileVersion], at least you can then see the version number when you look at the file with the Explorer.

  • You'll have to fix your solution. If you haven't already done so (you probably did), download the source code from the Codeplex depository and add the two projects to your solution. Use File > Add > Existing Project. Remove the assembly references in the WindowsFormsApplication1 project, they are definitely bad, and add them back, now selecting a project reference. This ensures that the assemblies are always built before your WindowsFormsApplication1 project and that it thus always uses the correct reference and thus the correct version number. Do make sure that the two DLLs in the Application Files dialog came from the project's Release build directory.

Lahey answered 14/3, 2016 at 7:24 Comment(3)
After removing the * from version and placing same version in both the projects didn't worked. I had downloaded both the projects and added there project reference in my window app. I have downloaded the fresh .dll only and the .dll reference rather than the project reference and it worked.Mixtec
Well, that would be another way to do it. When you only have a single downloaded DLL then it can't get mixed-up. Assumption in the answer is that you had a reason to change the library. Still doesn't explain what originally went wrong.Lahey
I am not able to figure out what wen wrong because same library already working in my one of the applications. I have taken the projects form there and using them into another project. Do this could be the reason. I also have to modify the code because it has a restriction of sending only 160 character of SMS.Mixtec
S
1

Try going to the Publish tab in the project properties and then select the Application Files button. Then set the following properties:

File Name of stdole.dll Publish status to Include Download Group to Required After that you need to republish your application.

If the reference has CopyLocal=true, then the reference will be published with the application. If the reference has CopyLocal=false then the reference will be marked as a prerequisite. This means the assembly must be installed in the client's GAC before the ClickOnce application will install.

There are some assemblies that are installed into the GAC because of the Visual Studio install, not the .NET Framework install. This could be your situation.

Survival answered 19/3, 2016 at 17:54 Comment(0)
B
0

I encountered the problem, too.

Basically ClickOnce defaults to "Publish Status = Prerequiste" for Dependencies from the GAC and you have to manually set Include. (That is what the outher posts are about, but that is not your problem here).

My guess is that something is wrong with how your dependencies are referenced.

a) Remove the reference to JamaaTech.Smpp.Net.Lib.v.1.4 and add it again. (Sometimes project references get messed up and the dependency is referenced from the referencing bin folder rather than its own which might be outdated).

b) Ensure that Copy Local = True is set for that reference.

c) Try to publish you app from the commandline with msbuild.exe /target:rebuild;publish yourproject.csproj to ensure a clean build.

(This does not support web publish but you can publish local and deploy it via ftp) https://mcmap.net/q/574104/-problems-using-msbuild-using-command-line-for-publish-click-once

d) After publishing ensure that inside the publish locations Application Files folder you find a JamaaTech.Smpp.Net.Lib.v.1.4 file. This is a zip file. You can extract it and check that the .rsrc\version.txt contains the same version as the .text file (open in text editor and scroll to end).

Banking answered 14/3, 2016 at 7:52 Comment(0)
A
0

I happened to me and complaining about NLog.dll, What I found is that my app referred one version of Nlog.dll and my library projects referred another version of Nlog.dll and manifest listed one version as dependency(install) and another version as dependency(requisite i.e. need to be present in the system even copy to local set to true).

Bottom line: if two version of the same dll referred across the dependent projects then that would be one of the root cause of the error.

Alamode answered 4/10, 2018 at 19:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.