title: "Value does not fall within the expected range." from System.Deployment when installing C#.net app
body: <p>I am using the Publish function within Visual Studio 2013 to deploy an application to a server.</p>
  
  <p>When I run the setup.exe it generates, I get a "Cannot Start Application" error.  I have tried a number of things to resolve the issue, including:</p>
  
  <ul>
  <li>restarting the machine</li>
  <li>changing the file and assembly versions under Project Settings/Application/Assembly Info... and disabling automatic revision incrementing per <a href="https://stackoverflow.com/questions/9704532/value-does-not-fall-in-the-expected-range-clickonce-deployment">&quot;Value Does not fall in the expected range&quot; ClickOnce Deployment</a></li>
  <li>changed the target CPU to x86 per <a href="https://stackoverflow.com/questions/9704532/value-does-not-fall-in-the-expected-range-clickonce-deployment">&quot;Value Does not fall in the expected range&quot; ClickOnce Deployment</a></li>
  </ul>
  
  <p>Any ideas?</p>
  
  <p>Below is the complete paste from the "Details..." file:</p>
  
  <pre><code>PLATFORM VERSION INFO
  Windows             : 6.1.7601.65536 (Win32NT)
  Common Language Runtime     : 4.0.30319.17929
  System.Deployment.dll       : 4.0.30319.17929 built by: FX45RTMREL
  clr.dll             : 4.0.30319.17929 built by: FX45RTMREL
  dfdll.dll           : 4.0.30319.17929 built by: FX45RTMREL
  dfshim.dll          : 4.0.41209.0 (Main.041209-0000)
  </code></pre>
  
  
  
  <pre><code>SOURCES
      Deployment url          : file:///C:/Users/Administrator/Desktop/bgapp/xmltest.application
      Application url         : file:///C:/Users/Administrator/Desktop/bgapp/Application%20Files/xmltest_1_0_1_0/xmltest.exe.manifest
  </code></pre>
  
  
  
  <pre><code>IDENTITIES
      Deployment Identity     : xmltest.application, Version=1.0.1.0, Culture=neutral, PublicKeyToken=7d533deea4ca951b, processorArchitecture=x86
      Application Identity        : xmltest.exe, Version=1.0.1.0, Culture=neutral, PublicKeyToken=7d533deea4ca951b, processorArchitecture=x86, type=win32
  </code></pre>
  
  
  
  <p>APPLICATION SUMMARY
      * Installable application.</p>
  
  <p>ERROR SUMMARY</p>
  
  <p>Below is a summary of the errors, details of these errors are listed later in the log.</p>
  
  <pre><code>* Activation of C:\Users\Administrator\Desktop\bgapp\xmltest.application resulted in exception.  Following failure messages were detected:
      + Value does not fall within the expected range.
  
  COMPONENT STORE TRANSACTION FAILURE SUMMARY
      No transaction error was detected.
  
  WARNINGS
      There were no warnings during this operation.
  
  OPERATION PROGRESS STATUS
      * [3/31/2014 7:32:14 PM] : Activation of C:\Users\Administrator\Desktop\bgapp\xmltest.application has started.
      * [3/31/2014 7:32:15 PM] : Processing of deployment manifest has successfully completed.
      * [3/31/2014 7:32:15 PM] : Installation of the application has started.
      * [3/31/2014 7:32:15 PM] : Processing of application manifest has successfully completed.
      * [3/31/2014 7:32:16 PM] : Found compatible runtime version 4.0.30319.
      * [3/31/2014 7:32:16 PM] : Request of trust and detection of platform is complete.
  
  ERROR DETAILS
      Following errors were detected during this operation.
      * [3/31/2014 7:32:16 PM] System.ArgumentException
          - Value does not fall within the expected range.
          - Source: System.Deployment
          - Stack trace:
              at System.Deployment.Internal.Isolation.IStore.LockApplicationPath(UInt32 Flags, IDefinitionAppId ApId, IntPtr&amp; Cookie)
              at System.Deployment.Application.ComponentStore.LockApplicationPath(DefinitionAppId definitionAppId)
              at System.Deployment.Application.SubscriptionStore.LockApplicationPath(DefinitionAppId definitionAppId)
              at System.Deployment.Application.FileDownloader.PatchFiles(SubscriptionState subState)
              at System.Deployment.Application.FileDownloader.Download(SubscriptionState subState)
              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&amp; downloadTemp)
              at System.Deployment.Application.ApplicationActivator.InstallApplication(SubscriptionState&amp; subState, ActivationDescription actDesc)
              at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String&amp; errorPageUrl)
              at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)
  </code></pre>
  
  
  
  <pre><code>COMPONENT STORE TRANSACTION DETAILS
      No transaction information is available.
  </code></pre>