ClickOnce with external EXE will not validate - c#

Here's a famous error I'm getting on VS 2010, using ClickOnce deployment. It works fine locally as well as with a setup deployment. The publishing is working fine.
Here's the error I receive when I try to install the application from the ClickOnce:
'Reference in the manifest does not match the identity of the downloaded assembly CrmSvcUtil.exe.'
I've tried the most popular solution (as well as all the other solution I found on internet) http://geekswithblogs.net/rakker/archive/2007/12/06/117449.aspx
I really don't know what to do. The CrmSvcUtil.exe is in my required files (added by itself... but if I remove it, the ClickOnce stops working at all)
Do you have any other idea of how to fix that? Or a workaround?
Thank you very much!

Is CrmSvcUtil.exe your main executable, or is it an additional executable in your application? It sounds like a change is being made to that file after the manifest has been created such that the file hash no longer matches (this can happen, for instance, if you sign your assembly after the manifest has been created).

Do you have that exe added to your project? What is the build action (should be 'content') and what is 'copy to output directory' ? (should be 'copy always').
Is that executable signed?
Are you publishing with Visual Studio?
Are you re-signing with Mage or MageUI after it is initially published?

Related

Could load a file or assembly "Renci.SshNet.dll"

Issue :
System.IO.FileNotFoundException: Could not load file or assembly
'Renci.SshNet, Version=2014.4.6.0, Culture=neutral,
PublicKeyToken=1cee9f8bde3db106' or one of its dependencies. The
system cannot find the file specified.
The Project is built on .Net Framework 4 which helps to transfer the files from local onto S FTP Server.
The Code works fine on my local machine without any issue,When deployed on the PROD server and run as per scheduled giving the error as mentioned above.
Let me know what exactly causing this issue.
If not installing from the gallery make sure the DLL is not marked as blocked. Windows will mark the zip and every file in it for security reasons and you will have to unblock them
Are you developing windows or web application? If web application, try enabling an option in IIS application pool -> Advanced Settings, "Enable 32 bit application" to true. This might solve your problem.
In case of windows or console application, select the reference Renci.SshNet dll and go to its properties and set "Specific version" to false.
After recently upgrading my .NET connector it gave the same error. I compile and run my app in VS and it works fine guessing because it copies all the MySQL NET assemblies to the exe folder so what I did is copied Renci.SshNet.dll to the directory of my exe and it worked. For some reason adding the path to the path system variable didn't help. Final solution was to remove the NET Connector and use mysqld in batch to do the selects and updates for the app.
Looks like you're missing the Renci.SshNet.dll.
In your project references you can edit the properties of Renci.SshNet. Make sure "Copy Local" ist set to true. It will copy the dll on build to your output directory (should be bin/Release).

prevent App.Config compiled into the dll VSTO (C# \ .Net)

I checked prior posts like How do I prevent the app.config from being integrated into a .net Library (dll)
but these did not help me with my situation.
I am having trouble keeping my Outlook addin app.config not compiled into the dll. I assume it's being compiled, as when it first loads I ask the application to show me the path of its configuration file using:
MessageBox.Show(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile.ToString());
This returns a path for a file at
C:\Users\...\AppData\ [random name]\outlookadddin.config
instead of using the app.config which is located in the same folder as the the dll itself.
Can I force configuration manager to refer to the dll in the same folder as the assembly rather than creating one of its own?
UPDATE:
after finding this:
how do I make my application read the application config instead of machine.config?
it seems to partially advance a solution, shortly explained, its a known issue with VSTO being deployed via ClickOnce \ MSI. you need to add |VSTOLOCAL to the registery manifest key path.
Problem im facing now, is that if i install my addin on a Network drive, using |VSTOLOCAL it simply won't load, removing |VSTOLOCAL and it works like a charm. any ideas ?
OK i finally found an answer to this:
it appears since vsto 4.0 - you MUST have |vstolocal at the end of the manifest registry key for it to use the .config file from the folder and not from the cache.
My issue was solved by adding |VSTOLOCAL to the regkey, but since i want the addin dll to be placed on a NETWORK drive, this caused trust issues with outlook, which for some reason appearse to be not supporting network drive-installed addins by default.
These were solved by adding this registry key:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\vsto runtime Setup\v4]
"EnableVSTOLocalUNC"=dword:00000001
Everything works well now.
Thanks everyone.

Mono for Android can not create assembly directory

I'm trying to create programs for Android in C#. When I start an emulator and I click the debug button, the output says:
Deployment failed. The assembly directory could not be created.
Have I to have a permission in AndroidManifest.xml, that allows me to create directories and files?
Thanks for answers :).
I have a same problem too.
Try This:
In Project Properties > Build > Change the platform target into x86.
Then Rebuild again.
hope this help.
in project option -> build -> mono for android build
check mark on 'use shared mono runtime'
Are you trying to create a directory in your code, or is this referring to the compiler's assembly directory? You only need a permission in the manifest if you are creating directories and files on the android device (i.e. in your code). You should not need this permission for a simple deployment.
Sometimes it's the simple things: make sure you have enough disk space, and that the full file path is not too long.
If none of that works, it may be an emulator problem; try it on a physical device to make sure.

Release Windows Forms project without an installer

I've built against the release profile and this creates an executable build within the release directory in my project.
How do I best distribute to clients from this executable? There are a lot of files within this folder which don't appear when installed through the installer, such as the mainifest and one called application.exe.xml (which is confusing when Windows hides the extension in Windows Explorer).
Are these all necessary? Can I just send the executable? Or will I need to send with all the files? Is there a way to build without all these files?
You must send the EXE file and any DLL file that you reference locally. If you use COM references and the like, you need to register them during the installation. The same thing for the GAC I think, but I haven't used that for stand-alone applications myself.
The application.exe.config file contains the application settings (a copy of app.config). If you don't use settings or the user doesn't typically care about them, you can omit the file, and it will use the default values you built the application with.
The vshost files are not needed (if you have them). They are used by Visual Studio's debugger. The .pdb files contain debug data used to facilitate DLL file to source matching. Unless you plan on attaching a debugger to the application, there is no point sending those.
Usually, in an XCopy deployment you have to deploy (literally copy all files deployment with no setup/installer program) the content of the output folder (like debug or release) without:
*.pdb - debug symbols
*.xml - xml documentation
?vshost? - Visual Studio hosting files
In fact, it anyway also depends on your specific application. As a developer, you need to know what you are producing; in case you are using an xml file which is not the result of the .NET documentation compiler, but a static file copied in the output folder, then do not forget to deploy it.
A last note: developers usually disable the option to hide file extensions in Windows Explorer ;-)
You need to understand what an installer does or why an installer is important.
An installer takes care of the basic environment. The installer can carry dependent assemblies/modules along with the application. It can also check if you need something before you run, like .NET on the target machine. It can also create the shortcuts on the desktop or start menu. Plus it also provides adequate options on the target machine to uninstall it.
If you wish to ship the executable alone, you might miss out some assemblies that the executable depends on. The target machine may or may not have the correct .NET version installed.
Use the program: HM NIS EDIT from HM Soft.
Build your project
Run NIS EDIT
Make a new script from the wizard (Ctrl + W)
Run all the steps
Select all the .dll and .exe files
Build a setup file

Find out all the files required to run a c# application

I need to generate a list of all the files which are enough to run my application on any machine. I need this for a setup program. When i go to bin/release folder i'm able to see some pdb files and some configuration files, which i think will not be needed. I tried to disable generation of pdb files too but it still generates pdb for the other projects present in the solution.
So i need a way in visual studio 2008, which can get me all the files (the .exe and .dll and other files) required by my application to run.
Thanks.
Have you tried publishing the application (Build > Publish [app])?
This should just copy all the essential files to the specified folder.
The pdb files are used for debugging. Building in "Release" mode should exclude these files.
You can also create a setup project within the solution. Using that project it is possible to see a list of included files.
If you make a release build or publish the application then you should have a complete set of assemblies your application needs.
However, it can still rely on assemblies which reside in the GAC (Global Assembly Cache) of your machine. Check the references of your project if you think there are assemblies missing in the bin folder.
To solve this exact problem with our software, we wrote a simple console app that finds all the .vbproj & .csproj files in our projects directory, then changes all of the to Release mode (which does not create pdb files, documentation files etc).
This is then run by the build machine (CruiseControl.Net) before it starts compiling the projects.

Categories