How do I fix an error when I publish a Visual Studio 2010 Application

This is my first time publishing an application.  I generally just use the .exe to run my frontend interface.  I use LINQ to connect to a SQL Server.

I ran publish, I double click the setup.exe and I get a "Cannot Start Application" message.  I click the details and I get these errors:

      Following errors were detected during this operation.
      * [4/21/2011 4:48:21 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& 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& 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)

I have no clue what this means....  can anyone tell me where to start?

Karen WilsonProgrammerAsked:
Who is Participating?
Carlos VillegasFull Stack .NET DeveloperCommented:
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Karen WilsonProgrammerAuthor Commented:
The first link - I don't have a & in my path name.  At least I think that's what it was referring to.
Second - I couldn't find
yv989c: Keeps mentioning ClickOnce

Am I missing an application to make my application work?  

Karen WilsonProgrammerAuthor Commented:
I've had some success...  Under Signing, I checked the ClickOnce manifest and under Security, I clicked Enable ClickOnce Security Settings.  

My next stopping point comes with the prerequisite of making sure the user has dotnetfx3.5 SP1 and MSChart.exe loaded.  If I do not use these prereqs - life is wonderful.  If I do use them, then I have problems.  

It appears that my MSChart.exe is the problem.  It will load without the 3.5 SP1 being selected but of course, it won't run without it.  

Any suggestions?
So the second link did help?

Have you added the prerequisites?
Karen WilsonProgrammerAuthor Commented:
All the references to ClickOnce in the links made me go through all the tabs in check the ClickOnce references.

I added prerequisites and the MSChart one is not working with the 3.5 SP1 package.
The reason ClickOnce is mentioned is that you used word "Publish" in your title which usually means using ClickOnce. Are you deploying using another method? Is the MSChart in a DLL?
Karen WilsonProgrammerAuthor Commented:
I have no idea what I am doing and/or deploying.  This is my first crack at using publish on one of my apps.  I added MSCharts per this information:

It shows up on my prereq list but when I publish, I have problems.
Karen WilsonProgrammerAuthor Commented:
Thanks, I'll check them out.  
Karen WilsonProgrammerAuthor Commented:
CodeCruiser -

I have been using MSChart.exe quite extensively.  I usually have the user load MSChart.exe on their computer and run it and then charts on my apps work.  These articles are about downloading MSChart and adding to your toolbox.  I have that completed.  

I need to figure out how to have MSChart automatically loaded when installing my published application.  I set it up as a prereq but it's not working.  
These links (especially the 2nd) are about deploying MSCharts not installing it on development machine.
Karen WilsonProgrammerAuthor Commented:
Oh yes... sorry, I had a weekend.

I did this as well.  I created a bootstrapper and the publish won't complete when I have the MS Chart selected in the prereq.  It's weird.  I have the 3.5 selected, it works.  I have MSChart selected, it won't go because it doesn't have 3.5 loaded. I select both and it fails.  

I am thinking maybe it's where I have the install location for the prereq's.  Let me play with that for a bit.  
Karen WilsonProgrammerAuthor Commented:
On the prereqs, chose the download from the following location as I put all the apps in a public folder.  It didn't build - had error with the .Net 3.5 part.  

Chose the prereq from the same location as my application.  Build succeeded.  Ran the set up and it failed with the MS Chart.  In review of the error log, I got this error.  I am researching it now.  

Copying files to temporary directory "C:\Users\kawilso1\AppData\Local\Temp\VSDF5B2.tmp\"
Downloading files to "C:\Users\kawilso1\AppData\Local\Temp\VSDF5B2.tmp\"
(4/26/2011 8:04:25 AM) Downloading 'MicrosoftChartControls\MSChart.exe' from 'MSChart.exe' to 'C:\Users\kawilso1\AppData\Local\Temp\VSDF5B2.tmp\'
Download completed at 4/26/2011 8:04:25 AM
Downloading failed with HRESULT=-2146697203
Karen WilsonProgrammerAuthor Commented:
I had to do a lot of test driving to figure out the problem.  After digging deep, I found that I had compiled the application with framework 3.5.  I changed it to 4.0 and things finally started clicking.  
1)  Used the second link (www.mycode...)  to bootstrap MSChart
2)  Even though, MSChart requires 3.5 SP1, I didn't include it in the prereq and my app picked up the MSChart.exe.
3) I  selected the download apps from the same location as my application in the prereq tab.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.