ClickOnce Deployment - FileNotFoundException - c#

I'm having a problem using ClickOnce,
It is an online Clickonce.
My project is C# project built in Visual Studio 2013.
The application works on 99% of the machines , but there are few computers which it doesnt deploy containing the error:
Following errors were detected during this operation. * [16/08/2015
14:19:05] System.IO.FileNotFoundException
- The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
- Source: mscorlib
- Stack trace: at System.Deployment.Internal.Isolation.IsolationInterop.CreateActContext(CreateActContextParameters&
Params) at
System.Deployment.Internal.Isolation.IsolationInterop.CreateActContext(IDefinitionAppId
AppId) at
System.ActivationContext.CreateFromName(ApplicationIdentity
applicationIdentity) at
System.ActivationContext.CreatePartialActivationContext(ApplicationIdentity
identity) at
System.Deployment.Application.ApplicationActivator.Activate(DefinitionAppId
appId, AssemblyManifest appManifest, String activationParameter,
Boolean useActivationParameter) at
System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri
activationUri, Boolean isShortcut, String textualSubId, String
deploymentProviderUrlFromExtension, BrowserSettings browserSettings,
String& errorPageUrl) at
System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object
state)
The error occur in the end of the installion, but I suppose it doesnt really install (there are some files in the appdata folder, but when I click the ClickOnce installer again, it reinstall it from 0)
I've done some research, and I got to the registry key :
HKEY_CURRENT_USER\Software\Classes\Software\Microsoft\Windows\CurrentVersion\Deployment\OnlineAppQuotaUsageEstimate
Which is the cache location for online Clickonce applications.
On the computers which works, after the installer the value change to 837207846
On the computers which the ClickOnce doesnt work, it changes to 0.
any suggestions how to fix that problem?

Related

VSTO Error System.IO.FileNotFoundException: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)

When I try to debug Excel workbook (VSTO) in Visual studio 2015 Enterprice, I get following error,
From: file:///c:/users/sameera.madhusanka/documents/visual studio 2015/Projects/ClassLibrary1/ExcelWorkbook2/bin/Debug/ExcelWorkbook2.vsto
The exception text:
System.IO.FileNotFoundException: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
at System.Deployment.Internal.Isolation.IsolationInterop.GetUserStore(UInt32 Flags, IntPtr hToken, Guid& riid)
at System.Deployment.Internal.Isolation.IsolationInterop.GetUserStore()
at System.Deployment.Application.ComponentStore..ctor(ComponentStoreType storeType, SubscriptionStore subStore)
at System.Deployment.Application.SubscriptionStore..ctor(String deployPath, String tempPath, ComponentStoreType storeType)
at System.Deployment.Application.SubscriptionStore.get_CurrentUser()
at System.Deployment.Application.DeploymentManager..ctor(Uri deploymentSource, Boolean isUpdate, Boolean isConfirmed, DownloadOptions downloadOptions, AsyncOperation optionalAsyncOp)
at System.Deployment.Application.InPlaceHostingManager..ctor(Uri deploymentManifest, Boolean launchInHostProcess)
at Microsoft.VisualStudio.Tools.Applications.Deployment.IPHMProxy..ctor(Uri uri)
at Microsoft.VisualStudio.Tools.Applications.Deployment.ClickOnceAddInDeploymentManager.get_Proxy()
at Microsoft.VisualStudio.Tools.Applications.Deployment.ClickOnceAddInDeploymentManager.GetManifests(TimeSpan timeout)
at Microsoft.VisualStudio.Tools.Applications.Deployment.ClickOnceAddInDeploymentManager.InstallAddIn()
You are missing one or more of the files in your deployment. Most probably you have something installed in the GAC on other machines, but the current one doesn't have a component or referenced assembly installed.
You can try turning on the enhanced logging and checking out the results. It might pinpoint exactly what file is missing. You can read more about this in the Enhanced Logging in ClickOnce Deployment article. Also I've found a similar forum thread - GetUserStore throws FileNotFoundException.

Clickonce WPF Windows 7 - The application is improperly formatted.

I have a machine with a clean install of Windows 7 where I want to install my app.
I've built a WPF App on Windows 10 with prerequisites of .NET 4.5 and Visual C++ Redistributable Packages for Visual Studio 2013
I've included them in my Clickonce installer as Prerequisites:
If I attempt to run the .application file that is generated from Clickonce on the Windows 7 machine, I get the following error:
Cannot Continue. The application is improperly formatted. Contact the
application vendor for assistance.
However, I run the setup.exe on my Windows 7 machine it correctly prompts that it needs to install .NET 4.5 and Visual C++ Redistributable Packages for Visual Studio 2013. It then successfully goes through the install process for each Prerequisite.
Except, after the Prerequisites are installed, I receive the same The application is improperly formatted. error from above.
If I then re-run the .application file it will finally install.
Either way, this is definitely not a good user experience. Is this something to do with building the App on Windows 10 and attempting to install on Windows 7?
I've seen this question which seems similar, however I am installing .NET 4.5 as a prerequisite:
Manifest may not be valid or the file could not be opened.
Below are the error details:
PLATFORM VERSION INFO
Windows : 6.1.7601.65536 (Win32NT)
Common Language Runtime : 2.0.50727.5420
System.Deployment.dll : 2.0.50727.5420 (Win7SP1.050727-5400)
mscorwks.dll : 2.0.50727.5420 (Win7SP1.050727-5400)
dfdll.dll : 2.0.50727.4927 (NetFXspW7.050727-4900)
dfshim.dll : 4.0.40305.0 (Main.040305-0000)
SOURCES
Deployment url : file:///C:/Users/BHS/Desktop/New%20folder/BHSScaleOps.application
ERROR SUMMARY
Below is a summary of the errors, details of these errors are listed later in the log.
* Activation of C:\Users\BHS\Desktop\New folder\BHSScaleOps.application resulted in exception. Following failure messages were detected:
+ Exception reading manifest from file:///C:/Users/BHS/Desktop/New%20folder/BHSScaleOps.application: the manifest may not be valid or the file could not be opened.
+ Manifest XML signature is not valid.
+ SignatureDescription could not be created for the signature algorithm supplied.
COMPONENT STORE TRANSACTION FAILURE SUMMARY
No transaction error was detected.
WARNINGS
There were no warnings during this operation.
OPERATION PROGRESS STATUS
* [3/21/2017 4:20:01 PM] : Activation of C:\Users\BHS\Desktop\New folder\BHSScaleOps.application has started.
ERROR DETAILS
Following errors were detected during this operation.
* [3/21/2017 4:20:01 PM] System.Deployment.Application.InvalidDeploymentException (ManifestParse)
- Exception reading manifest from file:///C:/Users/BHS/Desktop/New%20folder/BHSScaleOps.application: the manifest may not be valid or the file could not be opened.
- Source: System.Deployment
- Stack trace:
at System.Deployment.Application.ManifestReader.FromDocument(String localPath, ManifestType manifestType, Uri sourceUri)
at System.Deployment.Application.DownloadManager.DownloadDeploymentManifestDirectBypass(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState& subState, IDownloadNotification notification, DownloadOptions options, ServerInformation& serverInformation)
at System.Deployment.Application.DownloadManager.DownloadDeploymentManifestBypass(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState& subState, IDownloadNotification notification, DownloadOptions options)
at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)
--- Inner Exception ---
System.Deployment.Application.InvalidDeploymentException (SignatureValidation)
- Manifest XML signature is not valid.
- Source: System.Deployment
- Stack trace:
at System.Deployment.Application.Manifest.AssemblyManifest.ValidateSignature(Stream s)
at System.Deployment.Application.ManifestReader.FromDocument(String localPath, ManifestType manifestType, Uri sourceUri)
--- Inner Exception ---
System.Security.Cryptography.CryptographicException
- SignatureDescription could not be created for the signature algorithm supplied.
- Source: System.Security
- Stack trace:
at System.Security.Cryptography.Xml.SignedXml.CheckSignedInfo(AsymmetricAlgorithm key)
at System.Security.Cryptography.Xml.SignedXml.CheckSignatureReturningKey(AsymmetricAlgorithm& signingKey)
at System.Deployment.Internal.CodeSigning.SignedCmiManifest.Verify(CmiManifestVerifyFlags verifyFlags)
at System.Deployment.Application.Manifest.AssemblyManifest.ValidateSignature(Stream s)
COMPONENT STORE TRANSACTION DETAILS
No transaction information is available.
Your manifest is signed using SHA-256. When you try to install the ClickOnce application on a machine which has only .NET 4.0 installed you receive the Manifest XML signature is not valid error you mentioned because up to .NET 4.0 SHA-1 is expected.
This is why after you successfully installed .NET 4.5 as prerequisite everything works fine. I have no idea why this isn't working in a single step but requires two steps instead. Perhaps this relates to a restart required after installing the new framework version?
The solution is to use SHA-1 when signing your manifest. You can find information on how to achieve this in this answer from Miroslav Nedyalkov.

Strong name signature not valid for this assembly stdole.dll

I've just started to get the following error in my ClickOnce application. When installing and running the same application, after seemingly successful installation I get an error message:
Application Validation did not succeed
The error details I can see the problem to be:
Strong name signature not valid for this assembly stdole.dll.
When i click into details I get
ERROR DETAILS Following errors were detected during this operation.
* [04/13/2016 11:33:22 AM] System.Deployment.Application.InvalidDeploymentException
(SignatureValidation)
- Strong name signature not valid for this assembly stdole.dll.
- Source: System.Deployment
- Stack trace: at System.Deployment.Application.ComponentVerifier.VerifyStrongNameAssembly(String
filePath, AssemblyManifest assemblyManifest) at
System.Deployment.Application.ComponentVerifier.VerifyComponents()
at
System.Deployment.Application.DownloadManager.DownloadDependencies(SubscriptionState
subState, AssemblyManifest deployManifest, AssemblyManifest
appManifest, Uri sourceUriBase, String targetDirectory, String group,
IDownloadNotification notification, DownloadOptions options) at
System.Deployment.Application.ApplicationActivator.DownloadApplication(SubscriptionState
subState, ActivationDescription actDesc, Int64 transactionId,
TempDirectory& downloadTemp) at
System.Deployment.Application.ApplicationActivator.InstallApplication(SubscriptionState&
subState, ActivationDescription actDesc) at
System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri
activationUri, Boolean isShortcut, String textualSubId, String
deploymentProviderUrlFromExtension, BrowserSettings browserSettings,
String& errorPageUrl) at
System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object
state)
Hey Not sure if you still haven't figured out the problem but please refer to this article: strong-name-signature-not-valid-for-this-assembly-stdole-dll and apply it depending on the version of Visual Studio you are using.
The Problem is that the ClickOnce application is trying to use an unsigned version of the stdole dll but you need to have that signed.
Details from the webpage:
Open path “C:\Program Files (x86)\Microsoft Visual Studio 9.0\Visual Studio Tools for Office\PIA\Office11” and “C:\Program Files (x86)\Microsoft Visual Studio 9.0\Visual Studio Tools for Office\PIA\Office12”, there is file stdole.dll wich was 16kb large and not signed
Open the path “C:\Program Files (x86)\Microsoft.NET\Primary Interop Assemblies”, there is file stdole.dll wich was 25kb large and signed
Replaced the unsigned dlls with the signed ones and did another publish
This is a remarkably insidious problem that will sneak up on you again and again (dev boxes, build machines, etc). For whatever reason Microsoft keeps an old unsigned version of the assembly in the Visual Studio assembly search path.
Check out Why is Visual Studio 2015 adding stdole.dll and Microsoft.AnalysisServices.AdomdClient.dll to my project? for some more details and some answers which may help avoid this in the future.

C# ClickOnce ftp not working properly

after some research I made publish my files on ftp.
But when I download "setup.exe" file from web and trying run it, I getting error "Cannot Start Application"
I looked for same error but all answers was for others errors
Error summary was saying that my manifest may be not valid or file could not be opened, but then why other people can use ftp, create guides that its working.
ERROR SUMMARY
Below is a summary of the errors, details of these errors are listed later in the log.
* Activation of http://www.marzuk.site11.com/webtest/ClickOnceWebTest.application resulted in exception. Following failure messages were detected:
+ Exception reading manifest from http://www.marzuk.site11.com/webtest/Application%20Files/ClickOnceWebTest_1_0_0_0/ClickOnceWebTest.exe.manifest: the manifest may not be valid or the file could not be opened.
+ Unexpected end of file has occurred. The following elements are not closed: br, br. Line 3, position 254.
Some properties of publishing:
Used software Visual studio 2013
Web hosting http://www.000webhost.com/
publishing folder location ftp://web.site11.com/public_html/webtest/
installation folder URL http://www.web.site11.com/webtest/
deployment web page default.htm
So the main question is: What stopping setup from installation and what im doing wrong?
There is the full log of error:
PLATFORM VERSION INFO Windows : 6.2.9200.0 (Win32NT) Common Language Runtime : 4.0.30319.34014 System.Deployment.dll :
4.0.30319.33440 built by: FX45W81RTMREL clr.dll : 4.0.30319.34014 built by: FX45W81RTMGDR dfdll.dll : 4.0.30319.33440 built by: FX45W81RTMREL dfshim.dll : 6.3.9600.16384 (winblue_rtm.130821-1623)
SOURCES Deployment url : http://www.web.site11.com/webtest/ClickOnceWebTest.application
Server : Apache Deployment Provider url : http://www.web.site11.com/webtest/ClickOnceWebTest.application
IDENTITIES Deployment Identity : ClickOnceWebTest.application, Version=1.0.0.0, Culture=en-US, PublicKeyToken=b3b9502bd69c8e4f, processorArchitecture=msil
APPLICATION SUMMARY * Installable application.
ERROR SUMMARY Below is a summary of the errors, details of these errors are listed later in the log. * Activation of http://www.web.site11.com/webtest/ClickOnceWebTest.application resulted in exception. Following failure messages were detected: + Exception reading manifest from http://www.web.site11.com/webtest/Application%20Files/ClickOnceWebTest_1_0_0_0/ClickOnceWebTest.exe.manifest: the manifest may not be valid or the file could not be opened. + Unexpected end of file has occurred. The following elements are not closed: br, br. Line 3, position 254.
COMPONENT STORE TRANSACTION FAILURE SUMMARY No transaction error was detected.
WARNINGS There were no warnings during this operation.
OPERATION PROGRESS STATUS * [2014-06-27 16:09:22] : Activation of http://www.web.site11.com/webtest/ClickOnceWebTest.application has started. * [2014-06-27 16:09:23] : Processing of deployment manifest has successfully completed. * [2014-06-27 16:09:23] : Installation of the application has started.
ERROR DETAILS Following errors were detected during this operation. * [2014-06-27 16:09:23] System.Deployment.Application.InvalidDeploymentException (ManifestParse)
- Exception reading manifest from http://www.web.site11.com/webtest/Application%20Files/ClickOnceWebTest_1_0_0_0/ClickOnceWebTest.exe.manifest: the manifest may not be valid or the file could not be opened.
- Source: System.Deployment
- Stack trace: at System.Deployment.Application.ManifestReader.FromDocument(String localPath, ManifestType manifestType, Uri sourceUri) at System.Deployment.Application.DownloadManager.DownloadApplicationManifest(AssemblyManifest deploymentManifest, String targetDir, Uri deploymentUri, IDownloadNotification notification, DownloadOptions options, Uri& appSourceUri, String& appManifestPath) at System.Deployment.Application.DownloadManager.DownloadApplicationManifest(AssemblyManifest deploymentManifest, String targetDir, Uri deploymentUri, Uri& appSourceUri, String& appManifestPath) at System.Deployment.Application.ApplicationActivator.DownloadApplication(SubscriptionState subState, ActivationDescription actDesc, Int64 transactionId, TempDirectory& downloadTemp) at System.Deployment.Application.ApplicationActivator.InstallApplication(SubscriptionState& subState, ActivationDescription actDesc) at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl) at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state) --- Inner Exception --- System.Xml.XmlException
- Unexpected end of file has occurred. The following elements are not closed: br, br. Line 3, position 254.
- Source: System.Xml
- Stack trace: at System.Xml.XmlTextReaderImpl.Throw(String res, String arg) at System.Xml.XmlTextReaderImpl.ParseElementContent() at System.Deployment.Application.ManifestValidatingReader.XmlFilteredReader.Read() at System.Deployment.Application.ManifestValidatingReader.XmlFilteredReader.Read() at System.Xml.XmlTextReaderImpl.Skip() at System.Deployment.Application.ManifestValidatingReader.XmlFilteredReader.Read() at System.Xml.XmlTextReaderImpl.Skip() at System.Deployment.Application.ManifestValidatingReader.XmlFilteredReader.Read() at System.Xml.XmlCharCheckingReader.Read() at System.Xml.XsdValidatingReader.Read() at System.Deployment.Application.ManifestReader.FromDocument(String localPath, ManifestType manifestType, Uri sourceUri)
COMPONENT STORE TRANSACTION DETAILS No transaction information is available.
Have you checked the manifest file is valid? Is the webserver configured to serve up .manifest files? Some configuration is required on the server to deploy clickonce applications. Try deploying it to a local web server first.

Intermittent Catastrophic Failure exception with .Net application via PsExec

we're seeing an intermittent problem when we try to run a .Net 4.0 application on a remote computer via PsExec.
The target computer is Windows Server 2008 SP2 64-bit with .Net 4.0 and .Net 4.5 installed.
I've been told that this has been happening here since .Net 4.5 was installed, but I'm new to the project, so I can't confirm that this is when the problem started happening.
The code that is failing is doing this:
var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
return (ParameterData)config.GetSection("ParameterData");
Here's the stack trace:
System.Configuration.ConfigurationErrorsException: An error occurred loading a configuration file: Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED)) ---> System.Runtime.InteropServices.COMException: Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))
at System.Security.Policy.PEFileEvidenceFactory.GetLocationEvidence(SafePEFileHandle peFile, SecurityZone& zone, StringHandleOnStack retUrl)
at System.Security.Policy.PEFileEvidenceFactory.GenerateLocationEvidence()
at System.Security.Policy.PEFileEvidenceFactory.GenerateEvidence(Type evidenceType)
at System.Security.Policy.AssemblyEvidenceFactory.GenerateEvidence(Type evidenceType)
at System.Security.Policy.Evidence.GetHostEvidenceNoLock(Type type)
at System.Security.Policy.Evidence.GetHostEvidence(Type type, Boolean markDelayEvaluatedEvidenceUsed)
at System.Security.Policy.AppDomainEvidenceFactory.GenerateEvidence(Type evidenceType)
at System.Security.Policy.Evidence.GetHostEvidenceNoLock(Type type)
at System.Security.Policy.Evidence.RawEvidenceEnumerator.MoveNext()
at System.Security.Policy.Evidence.EvidenceEnumerator.MoveNext()
at System.Configuration.ClientConfigPaths.GetEvidenceInfo(AppDomain appDomain, String exePath, String& typeName)
at System.Configuration.ClientConfigPaths.GetTypeAndHashSuffix(AppDomain appDomain, String exePath)
at System.Configuration.ClientConfigPaths..ctor(String exePath, Boolean includeUserConfig)
at System.Configuration.ClientConfigurationHost.get_ConfigPaths()
at System.Configuration.ClientConfigurationHost.GetStreamName(String configPath)
at System.Configuration.BaseConfigurationRecord.InitConfigFromFile()
--- End of inner exception stack trace ---
at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)
at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors)
at System.Configuration.Configuration..ctor(String locationSubPath, Type typeConfigHost, Object[] hostInitConfigurationParams)
at System.Configuration.ClientConfigurationHost.OpenExeConfiguration(ConfigurationFileMap fileMap, Boolean isMachine, ConfigurationUserLevel userLevel, String exePath)
at System.Configuration.ConfigurationManager.OpenExeConfigurationImpl(ConfigurationFileMap fileMap, Boolean isMachine, ConfigurationUserLevel userLevel, String exePath, Boolean preLoad)
at System.Configuration.ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel userLevel)
This is executed during our automated test build deployment process. I've been able to boil it down to a simple executable that does the code above, and I call PsExec from my Windows 7 development machine, but the problem's intermittent.
It seems to occur more regularly if I wait several minutes between invocations of PsExec. I started looking at this problem today, and was able to repro it pretty regularly in the morning, but not very easily in the afternoon.
I also see warnings like this in the Event Log:
Windows detected your registry file is still in use by other applications or services. The file will be unloaded now. The applications or services that hold your registry file may not function properly afterwards.
DETAIL -
1 user registry handles leaked from \Registry\User\mySID:
Process 5568 () has opened key \REGISTRY\USER\mySID
I don't know how the Event Log errors are related to the exception, if at all.
The PsExec command line is: PsExec /accepteula \\myServerName -d "path_to_exe"
I'm wondering if it's a problem with the user profile service, so I was thinking about not loading the profile when calling PsExec, but since it's so intermittent, I'm not sure how I would know if I've fixed it.
Searching the internet shows that some people think it might be related to impersonation, but nothing that directly matches my situation.
Has anyone seen anything like this? This is really weird.
Thanks!
Phil
if it works when run locally but not when run remotely there's a possibility:
When using PsExec the programs on the remote machine are limited to 150MB of memory
Running this on the remote machine will allow remote commands to use more than 150 MB of memory:
set-item wsman:localhost\Shell\MaxMemoryPerShellMB 2048

Categories

Resources