locked
Deploying a ClickOnce to Multiple environments RRS feed

  • Question

  • Hello.  For the life of me I cannot deploy my clickOnce application to our DEV environment (\\dev\apps\DLead\), QA environment (\\qa\apps\DLead\) or our PRODUCTION environment (\\prod\apps\DLead\) without the latest publish overwriting the others.  For example, if I publish to the Dev environment with its config file settings, and then publish to our QA environment with it's config file settings then the application when ran from \\dev\apps\DLead\ will pull the QA deployment.  I have looked threw hundreds of sites and about 90 percent of them say that I need to Sign the ClickOnce Manifests with a different certificate for each environment.  So the first thing I do is create 3 certificates; DEVCert.pfx, QACert.pfx and PRODCert.pfx. 

    (I create these certificates the following way: I open up the SDK Command prompt (Start>All Programs> Microsoft .NET Framework SDK v2.0>SDK Command Prompt) and type in the following: "makecert -r -pe -n "CN=DEVCert" -b 01/01/2010 -e 01/01/2020 -sky exchange -ss my".  Then I open up IE, go to options, content, certificates and export my newly created certificates with a different password for each.  So now all three .pfx's are on my desktop.)

    Ok, so now I go to deploy my VSTO clickonce application to the DEV environment.  I change the following on the application tab: The assembly name is set to DLeadDEV.  I click on the Assembly Information button and change the title to DLeadDEV and the product to DLeadDEV.  I change the following on the signing tab: I check the "Sign the ClickOnce manifests", click the "Select from File..." button and select the DEVCert.pfx file from my desktop.  It prompts me for the password and I enter it.  I leave the "Sign the assembly" check box UNchecked.  I change the following on the Publish tab: The publishing Folder Location and the Installation Folder URL are both set to \\dev\apps\DLead\.  I click the options button and change the product name and solution name to DLeadDEV.  I enter the latest revision number so I do not overwrite old deployments (1.0.0.33) and click the publish button.

    So at this point, everything works great!  My application is now in my dev environment (\\dev\apps\DLead\).

    Now I want to publish my application to my QA environment with its config file settings.  I change the app.config file, and repeat the above steps:

    I change the following on the application tab: The assembly name is set to DLeadQA.  I click on the Assembly Information button and change the title to DLeadQA and the product to DLeadQA.  I change the following on the signing tab: I check the "Sign the ClickOnce manifests", click the "Select from File..." button and select the QACert.pfx file from my desktop.  It prompts me for the password and I enter it.  I leave the "Sign the assembly" check box UNchecked.  I change the following on the Publish tab: The publishing Folder Location and the Installation Folder URL are both set to \\qa\apps\DLead\.  I click the options button and change the product name and solution name to DLeadQA.  I enter the latest revision number so I do not overwrite old deployments (1.0.0.34) and click the publish button.

    I get the following message:

    "The updated version of the application is signed with a different key thatn the published version.  Do you want to overwrite?" 

    So I click yes.  So now when I launch my application from \\qa\apps\DLead\ I see the QA version, however, when I launch my application from \\dev\apps\DLead\ the QA version runs.

    What am I doing wrong?  Do I need to use MageUI.exe?  I have been trying to get this working for a couple days now and it is driving me crazy. 

    Because I am unable to follow any articles out there, would someone be so kind to provide me step-by-step instructions to get this working?

    I appreciate your time in reading and helping me!

    Thanks,

    Tuesday, February 1, 2011 7:34 PM

Answers

  • Hi,

    I had another meeting with the ClickOnce lead, and we discussed this some more. Here's what he said:

    Two things need to changed in the project file for word document solutions

    1)      Assembly Name

    <AssemblyName>WordDocument1debug</AssemblyName>

    (Can also be changed through properties page)

    2)      SolutionID GUID

    <SolutionID>xxxxxxx</SolutionID>

    I usually just create another project to generate a new solution id guid and then pick it up and replace the old one as needed…..

     

    The solutionID guid is in the project file. Actually, both properties are in the project file.

    If you can get it to work, you can tweak it to work automatically between different msbuild configs, so depending on the msbuild config, one of the values is used. It would be something similar to this:

    http://blogs.msdn.com/b/vsto/archive/2010/03/09/tricks-with-app-config-and-clickonce-deployment-saurabh-bhatia.aspx

     

    but instead of config file and itemgroup it would be for these properties…

    RobinDotnet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    • Proposed as answer by Mike Dos Zhang Thursday, April 14, 2011 4:47 PM
    • Marked as answer by DRHarvey Monday, April 18, 2011 2:46 PM
    Monday, April 11, 2011 6:32 AM

All replies

  • Hi DRHarvey,

     

    I think I need to clear about the following questions to clear about the situation in your side:

    Have you try to run the \\dev\apps\DLead\vstoApplication before your publish your application to the \\qa\apps\DLead\ and after you published it to the dev machine?

     

    --> "The updated version of the application is signed with a different key thatn the published version.  Do you want to overwrite?"

    And I think maybe you had over written the files in the dev machine when you finished to publish the files to the qa machine. So I think  you will need to ensure this. If so, maybe you need to select "No" when you facing the above message box.

     

    If there's any concern, please feel free to let me know.

     

    Have a nice day!


    Mike [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, February 2, 2011 6:29 AM
  • Thank you for your help.

    Once the application is deployed to  \\dev\apps\DLead\, I run the vsto applicaiton and you can see it download from the correct location ( \\dev\apps\DLead\).  When I deploy to the \\qa\apps\DLead\ location and run the vsto application from that path, it downloads from the correct location still.  The problem is that when I try to run the vsto application from \\dev\apps\DLead\ it downloads from the wrong path (you can see it run from \\qa\apps\DLead\).

    As for clicking no to that message above, then the publish gets cancelled.  I need to publish the vsto application, so I have to press yes or deploy it without signing the manifests with different certificates.

    Any ideas?

    Wednesday, February 2, 2011 2:09 PM
  • No matter what I do, whichever application I run from whichever path will always run the latest version of the application I have deployed, even though the paths are different.

    Wednesday, February 2, 2011 2:13 PM
  • Hi DRHarvey,

     

    Would you mind introduce this project?

     

    I think it maybe helpful, if you can show us what is this project, and which way you execute the assembly after they were deployed to the different environments.

     

    I'm not familiar with the VSTO assembly, and the deployment for VSTO assembly.

     

    Can you provide the test project and the repro steps, or the screen recorder, it will be helpful for us to research this issue in our side.

    windows7dos@hotmail.com

     

    If there's any concern, please feel free to let me know.

     

    Have a nice day!


    Mike [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, February 9, 2011 1:46 AM
  • To run side-by-side versions of the same application, you need to change the assembly name, the installation URL, and if it's a client application, change the product name so it provides clarity when it shows up on the start menu. This article will probably help you even though you are doing VSTO.

    http://robindotnet.wordpress.com/2009/04/22/clickonce-installing-multiple-versions-concurrently/

    RobinDotNet

     


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    Wednesday, February 9, 2011 5:01 AM
  • Hello RobinDotNet,

    I have tried what you suggested, and it did not work.  I can email you the project also if you would like.  Please let me know your email address and I will send it.  As you can see from my original posting, I changed the assembly name, installation URL and the product name.  But still, no matter what I do, the latest deployment is being pulled from each environment.

    Thursday, February 10, 2011 3:33 PM
  • Hi DRHarvey,

     

    windows7dos@hotmail.com

    This is my email, you can send a copy of your test project besides send it to RobinDotNet.

     

    If there's any concern, please feel free to let me know.

     

    Best wishes,


    Mike [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, February 11, 2011 9:06 AM
  • I've also been researching this topic for the last couple of weeks, and, I'm surprised that no one considered the need for ClickOnce applications to be deployed for different purposes; development, testing or production. If your application works offline & online this is a real problem. Even if your build server is flexible, having to change the assembly name is quite invasive and you really don't want to have to have to recompile any application 3 times.... All our configuration customization occurs after the compilation phase.

    Sunday, February 13, 2011 7:11 PM
  • Hello Mike Dos Zhang,

    Did you receive my email with the test project?

     

    Thanks,

    Monday, February 14, 2011 7:03 PM
  • Hi DRHarvey,

     

    I just receive a email, but not project attached. Do you mind send it again?

     

    If there's any concern, please feel free to let me know.

     

    Best wishes,


    Mike [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, February 15, 2011 2:57 AM
  • Hi DRHarvey,

     

    I got your project.

    I will go on to research this question, maybe cannot show you a quick response.

     

    If there's any concern, please feel free to let me know.

     

    Best wishes,


    Mike [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, February 17, 2011 5:38 AM
  • They HAVE considered it, and there are blog entries for how to handle changing out the app.config file, but nothing about running versions concurrently on the same machine.

    You can, of course, deploy three different versions for three different people. It's the "running them concurrently on the same machine" bit that makes it more difficult. The assembly name is one of the properties used to define the deployment, which is why you have to change it in order to install multiple versions concurrently.

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    Thursday, February 17, 2011 8:51 AM
  • RobinDotNet,

    I am still having trouble deploying my application to different machines.  I deploy to my DEV machine with a dev assembly name and the dev installation URL, but when I deploy to my QA machine with a qa assembly name and a qa installation url it messes up the dev version.  When I run the dev version you can see it pull the updates from the QA deployment.  Any ideas?

    Thursday, February 17, 2011 3:30 PM
  • Can you check your Updates dialog and see if you specified an Updates URL?  (If it's the same as your installation URL, you don't need to fill this in.)

    And I just want to doublecheck - your installation URL is different for each version, right? And the Publishing File Location?

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    Thursday, February 17, 2011 6:07 PM
  • Hi DRHarvey,

     

    If you uninstall the DEV program (it will be located in the Add/Remove Programs), and then run the QA application, the QA application now pulls from the QA manifest, however the DEV program will now pull from the QA manifest.

     

    What do you mean you uninstall the DEV program, and then " the DEV program will now pull from the QA manifest"?

     

    Do you mean you execute the DemoVSTO.xlsx file under the DEV published folder after you install the QA program in local system?

     

    If so, the expert result is both of the files will show you "This is the qa environment!", since the app.settings file folder has not been changed but the settings changed to qa settings.

     

    I have tested the test project in my three computer, one is local, one as the dev computer, and another as the qa computer, and using the steps you descript in the "How to Recreate issue.docx" file. I publish the project from local computer to the others, and then install the two project through the UNC path. I execute the DemoVSTO.xlsx file after I install the project and then copy it to the local desktop( and rename).

     

    @RobinDotNet

    Is there any update on your side?

     

    If there's any concern, please feel free to let me know.

     

    Best wishes,


    Mike [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, February 18, 2011 6:30 AM
  • Hi DRHarvey,

    Best wishes,


    Mike [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, February 21, 2011 5:45 AM
  • Hello Mike Dos Zhang,

    What I mean by

    "If you uninstall the DEV program (it will be located in the Add/Remove Programs), and then run the QA application, the QA application now pulls from the QA manifest, however the DEV program will now pull from the QA manifest."

    Is that when you publish to the development computer with the development config file, and run the DemoVSTO.xlsx file from the development location everything works as expected.  The problem that I am having is when I then publish to our QA computer with the QA config file, and then try to run the DemoVSTO.xlsx from the development location again, it now pulls the QA config settings instead of the dev config settings like it was before I published to the QA computer.

    What I want is to have my application work in all 3 different environments concurently.  I cannot achieve this because as soon as I publish to a different computer with a different config file, this interferes with the previous deployment even though I changed the publishing folder location and the installation folder URL to be the same UNC path for each environment (an example of that below).

     

    My development publish tab:

    Publishing Folder Location: \\dev\apps\DemoVSTO\

    Installation Folder URL: \\dev\apps\DemoVSTO\

    My QA publish tab:

    Publishing Folder Location: \\qa\apps\DemoVSTO\

    Installation Folder URL: \\qa\apps\DemoVSTO\

     

    Please let me know if you need any further clarification.  And once again, thanks for taking the time to help!


    Dan
    Monday, February 21, 2011 9:46 PM
  • Hi DRHarvey,

     

    I tried again, but failed. I just do the steps what you told in your post, but I also can get "This is the DEV environment!" in the dev computer.

     

    Have you got the other settings? I think you can try to create another new project, and remember every steps you did in this new project, to see if one option result this issue in your side.

     

    The application is signed with a different key than the existing application on the server. Do you want to overwrite it?

    Shown when you try to update the server with an application signed with a different key (that is, you picked a different key from the Signing page of theProject Designer; see Signing Page, Project Designer).

     

    And I also try to repro this problem, through the document and the test result, it seems that this message will show when you publish the product to the same path. And when I publish the project to the different two dev and qa computer, there's no such message showed to me.

     

    @RobinDotNet

    Have you successful to repro this issue in your side?

     

    If there's any concern, please feel free to let me know.

     

    Best wishes,


    Mike [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, February 22, 2011 6:04 AM
  • As soon as you publish to the QA location, and once you run the application from the QA location, it displays the dev config settings.  So at this point, check the add/remove programs and you will see the only application installed is the DemoVSTODEV application.  So what i do at this point is double click the DemoVSTOQA.vsto manifest file to be prompted to install the QA version.  Then once it's installed, check the add/remove programs again, and you will see the DemoVSTOQA application is now there.  Run the application from the QA location, and it uses the QA config file.  Now, when you run the application from the DEV location, you see that it is pulling from the QA config file.

     

     


    Dan
    Tuesday, February 22, 2011 1:42 PM
  • So you are using document-level VSTO applications, right? Just for grins, try naming the documents with different names. Unlike a WinForms or WPF app, where the assembly name decides the difference, maybe with documents it's the name that determines the difference. If you look at the different deployments, do the vsto files have the same name? If so, then  that's your problem.

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    Wednesday, February 23, 2011 8:29 AM
  • Hello RobinDotNet,

    I tried as you said, and no luck.  As long as one environment is installed (running a published file from the DEV location for example), if you try to publish to a different environment and run that file (publishing to the QA computer with its QA settings), it doesn't prompt you to install this version, it just looks at the DEV install.  I renamed the actual file name throughout the process from DemoVSTODEV.xlsx to DemoVSTOQA.xlsx and still no avail.

    Any other suggestions?  Can I send you a my demo application with instructions on how to recreate the issue?

    Thanks!


    Dan
    Wednesday, February 23, 2011 1:30 PM
  • Hi Dan,

    I have your demo app, I got it from Mike. I am meeting with the ClickOnce guys at Microsoft next week. I will ask them if they have any suggestions for you, and report back the week after that. Okay?

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    Thursday, February 24, 2011 8:23 AM
  • Thank you for your help, because the only solution that I can see, is to create 3 separate duplicate visual studio solutions to achieve this (one for each environment), and I feel like there should be a better way.

    Thanks again!


    Dan
    Thursday, February 24, 2011 1:53 PM
  • Hi ,

     

    The application is signed with a different key than the existing application on the server. Do you want to overwrite it?

    Shown when you try to update the server with an application signed with a different key (that is, you picked a different key from the Signing page of theProject Designer; see Signing Page, Project Designer).

    And I also try to repro this problem, through the document and the test result, it seems that this message will show when you publish the product to the same path. And when I publish the project to the different two dev and qa computer, there's no such message showed to me.

     

    I think we need to clear about this question first, what about your opinion, Robin?

     

    And can you ensure this question, DRHarvey?

     

    If there's any concern, please feel free to let me know.

     

    Best wishes,


    Mike [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, March 1, 2011 8:28 AM
  • Yes, this definitely happens when trying to deploy the VSTO application to a different environment with a different key.  I emailed the authors of a VSTO book and hopefully they may be able to help too.  I will let you guys know what they say.  I have a feeling that you cannot deploy different versions of a VSTO application     : (

    Thanks,


    Dan
    Tuesday, March 1, 2011 10:12 PM
  • OK, I will wait for your update, and on another hand, I will go on researching this issue in our side.

    If there's any concern, please feel free to let me know.

    Best wishes,


    Mike [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, March 3, 2011 8:30 AM
  • Hi DRHarvey,

    I'm also trying to repro this issue in our local side, but it also fail.

    Maybe we need more time to analysis this issue and try to repro and find the probable cause.

    And maybe cannot show you a quick response, since this issue is strange, I think.

    We will show you a response once we have any update on researching this problem.

     

    If you have any update, please feel free to let us know. It may speed up solving this issue.

    Have a nice day!


    Mike [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, March 7, 2011 6:28 AM
  • Okay, I have a probably solution for you. I talked to the ClickOnce guy at Microsoft about your thread.

    He said VSTO has its own layer on top of clickonce that adds to the complexity, which is why you can't just change the assembly name and move on. There is a GUID involved.

    There is a GUID inside the csproj file that identifies the deployment, and that same GUID appears inside the document's properties. To install side-by-side versions, you need to change the GUID for each version (the csproj file must match the document). This is in addition to changing the publishing URL and the assembly name. If you do this, you should be able to run multiple versions on the same machine.

    Also, he strongly recommended that you don't test it on the same machine you're developing on, or you'll get totally screwed up.

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    Tuesday, March 8, 2011 9:01 PM
  • Wow, I know this has been a tough one and I appreciate everyones help.  I will try this and see if it solves my issue.  Will let you know.

     

    Thanks!


    Dan
    Tuesday, March 8, 2011 10:26 PM
  • If the guid you are referring to is the one found by right clicking on the VSTO project, click on properties, under the Application tab, clicking the "Assembly Information" button, and changing that GUID (changed the last 4 digits) than this did not work.

    I will keep at it.

     

    Thanks,


    Dan
    Tuesday, March 8, 2011 10:48 PM
  • Hi Robin and DRHarvey,

    @DRHarvey

    If I also have not misunderstood the situations in your side, you're installing the vsto application on the different computer systems, right? Since I saw you use the different UNC.

    @Robin

    WOW...

    Thanks, man! You're really a good man!   :-)

    As I known, the side-by-side is talking about under the same system. But I think OP install the assemblies on the two different computers, if I have not misunderstood OP's description before.

     

    Best wishes,


    Mike [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, March 9, 2011 8:46 PM
  • What GUID needs to be changed?


    Dan
    Monday, March 14, 2011 6:56 PM
  • @ Mike

    Yes, that's correct

    @Robin

    This did not work.  If you have the sample application with you still, you will see that changing this GUID does not solve the problem.

    Any suggestions?


    Dan
    Monday, March 14, 2011 7:32 PM
  • Hi DRHarvey,

     

    Maybe you can try to consider the application level application instead of this one. And let user select or according the user or other things to decide load which customizations.

    And base on my experience, the common windows Form can be implement this request, but the VSTO product cannot implement this request just modified the assembly name and GUID so easy. It also need modify the other things.

     

    Or you can try to consider to use one source file and create two project in vs, then you can share the one source file two projects. The following article show you the methods how to share the source file to among projects.

    http://www.j2i.net/BlogEngine/post/2010/02/27/Sharing-Source-Files-Among-Projects.aspx

    Maybe you can try to research these two solutions.

     

    For more VSTO and office dev questions, I think the following forums will be suitable for you. The experts live in there have more such development experiences, which can give you more expert help, I think, even to the deployment questions for vsto projects.

     

    I think I have no idea about if there's another solutions for you now.

     

    @Robin

    Thanks for your activities in forums, again!

     

    Have a nice day!


    Mike [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Proposed as answer by Mike Dos Zhang Thursday, April 7, 2011 3:57 AM
    • Unproposed as answer by RobinDotNet Thursday, April 14, 2011 5:21 PM
    Tuesday, March 15, 2011 10:03 AM
  • Hi DRHarvey,

    I am writing to check the status of the issue on your side. 

    What about this problem now? 

    Would you mind letting us know the result of the suggestions?

     

    Best wishes,


    Mike [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, March 21, 2011 8:22 AM
  • Issue is still not solved.  As you can see with the sample application provided, changing the GUID does not fix the problem.  I decided to take your advice and post in the VSTO forum and see if someone could help me there:

     

    http://social.msdn.microsoft.com/Forums/en/vsto/thread/3ae5556b-3c8b-4228-8024-a65d20ed8436

     

    Thanks,


    Dan
    Monday, March 21, 2011 12:45 PM
  • Hi DRHarvey,

    If there's any update, please show us, so that we can go on follow this question. 

    And I also suggest you to consider my suggestions in my last second post, you also can refer it in that thread and discuss with other members if my suggestion is the suitable solution for this question.

     

    Best wishes,


    Mike [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, March 23, 2011 3:38 AM
  • So i posted in a second forum, but I haven't gotten any responses.

    http://social.msdn.microsoft.com/Forums/en/vsto/thread/3ae5556b-3c8b-4228-8024-a65d20ed8436


    Dan
    Tuesday, April 5, 2011 6:46 PM
  • Hi DRHarvey,

    Maybe they have not found another solution rather than I provided above.

    So I also suggest you consider to use my solutions rather than to search others solutions, since we don't know if another solution is existing.

     

    Have a nice day!


    Mike [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, April 8, 2011 8:39 AM
  • Hi,

    I had another meeting with the ClickOnce lead, and we discussed this some more. Here's what he said:

    Two things need to changed in the project file for word document solutions

    1)      Assembly Name

    <AssemblyName>WordDocument1debug</AssemblyName>

    (Can also be changed through properties page)

    2)      SolutionID GUID

    <SolutionID>xxxxxxx</SolutionID>

    I usually just create another project to generate a new solution id guid and then pick it up and replace the old one as needed…..

     

    The solutionID guid is in the project file. Actually, both properties are in the project file.

    If you can get it to work, you can tweak it to work automatically between different msbuild configs, so depending on the msbuild config, one of the values is used. It would be something similar to this:

    http://blogs.msdn.com/b/vsto/archive/2010/03/09/tricks-with-app-config-and-clickonce-deployment-saurabh-bhatia.aspx

     

    but instead of config file and itemgroup it would be for these properties…

    RobinDotnet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    • Proposed as answer by Mike Dos Zhang Thursday, April 14, 2011 4:47 PM
    • Marked as answer by DRHarvey Monday, April 18, 2011 2:46 PM
    Monday, April 11, 2011 6:32 AM
  • Hi Robin,

    Perfect!!!

    This is a good idea!

    PS: It just like create another project as I mentioned use two project. But this idea is better than mine, I think.

     

    Thanks for sharing your experiences!

     

    Have a nice day!


    Mike [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, April 14, 2011 4:47 PM
  • Mike,

    If he creates another project and has two main projects, clickonce will not work correctly. It will publish both of the projects simultaneously. I can't open the link that you posted, but if you mean to have two solutions that share source code, that's a complicated solution that would also require that he maintain two sets of ClickOnce settings, which opens him up for manual error causing problems, so it's not optimal.

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    Thursday, April 14, 2011 5:27 PM
  • Yes, I just want mean that, sharing source code among two solutions, sorry for my no good description.

    The following is the content in that link.

    There are times when you will want to share the same source code among several projects. A common way to do so is with a shared assembly; you put common functionality in one project and then share the output among several other projects. But at times this solution isn't suitable such as when you have functionality that you plan to share across more than one .Net runtime (ex: Desktop Framework, Compact Framework, and Silverlight Runtime). For these cases you can copy your source code to the projects for all three run times. But then you end up with three branches of code and may need to make sure thay are synced up with each other.

    It is possible to use the same source file in different projects by adding a link for the file from another project so that each project is using the same runtime. Since it is the same physical files changes to the file done from one project are visible to all the projects using the same linked file. Adding a linked file is easy. To link to one file's project from another right-click on the project, select Add->Existing Item and navigate to the file. Once you've found the file click on it and then click on the down triangle on the Add button and select "Add as Link."

    A potential problem from using this solution is you may have items in a class that you don't want to be visible in another class. You can selectivly hide sections of code using a few preprocessor directives. As a simple example let's say I made a Windows Form application and I have all of the files from it linked to a second project. I have code in a method that is setting the text on a label. But I want the text to be set differently depending on the project in which it is run. The preprocessor directives I will use are #if, #else, and #endif.

    #if App1
          txtMyMessage.Text="Hello from App1";
    #else
          txtMyMessage.Text = "Hello from App2";
    #endif

    In the above code only the C# code in the #else, block will be compiled. The code in the #if block will be ignore. For my first project I want to code in the #if block to be used. To accomplish this I need to add a Conditional Compilation Symbol. I right-click on the project and select Properties. Under the Build tab I can add conditional compilation symbols. I've done this for the first project and have added a symbol named App1. So now the first block of code will get compiled and the second block ignored.

    While this solution has it's advantages it is not the end-all solution for sharing functionality across projects. If you find yourself using excessive conditional compilation blocks in your code then you may have reached a point at which it is better off having two seperate source files.

    Have a nice day!


    Mike [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, April 15, 2011 3:41 AM
  • Hi DRHarvey,

    I am writing to check the status of the issue on your side. 

    What about this problem now? 

    Would you mind letting us know the result of the suggestions?

    Best wishes,


    Mike [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, April 18, 2011 1:17 PM
  • Hi DRHarvey,

    The "DemoVSTO.vbproj" file is what you would like.

    You can right click on the project from the "Solution Explorer", and select "Unload Project", and then right click on the project and select "Edit DemoVSTO.vbproj", then you can modify the SolutionID, after the modification, you just need to right click on the project and select "Reload Project", then you can publish it for another version.

    Best wishes,


    Mike [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Monday, April 18, 2011 2:35 PM
  • SUCCESS!!!

    I did a right click, open with notepad on the project file and changed both of these values.  I opened the excel file from my dev environment and I get the DEV Settings.  I then open the excel file from my QA environment and I get the QA settings.  I THEN GO BACK to my dev excel file, open it back up, and it's still pulling the correct settings!!!!

    This was it, thank you so much for your help guys!


    Dan

    Monday, April 18, 2011 2:45 PM
  • You're welcome!

    I'm glad to hear that this request solved.

    And thanks Robin for the good idea!

     

    Have a nice day!


    Mike [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, April 19, 2011 2:55 PM