ClickOnce Deployment Trick

This post has 18 Replies | 4 Followers

Top 25 Contributor
Posts 188
SunBurn_Contributor
SunBurn_Pro_Licensee
SunBurn_Studio_Licensee
Adam Kane Posted: 07-12-2011 6:12 PM

Hello,

I don't know if this is common knowledge or not, but if you're doing Windows deployment via ClickOnce, here's a cool deployment trick.  It gets around having to manually swap the development DLL with the redistributable DLL when you originally publish or publish an update to your ClickOnce-deployed SunBurn application.

First, reference the deployment DLL (A) as usual.  Also include the redstributable DLL (B) in your solution:

Be sure to set the properties of the redistributable DLL so that it's not compiled, but is copied to the output directory:

Under Project Properties > Publish > Application Files, exclude the development DLL and include the redistributable DLL.:

Note: The redistributable DLL is in a folder so that there aren't two duplicate items in the files list. The folder is the exact name of the dll since that's one of the default paths that an application will search to find a specific dll.

That's it. Now when you're developing, the development DLL will be used, but whenever you publish your ClickOnce application, the redistributable DLL will be used.

Aloha,
Adam

Top 10 Contributor
Posts 1,131
SunBurn_Community_Licensee
SunBurn_Contributor

Nice trick Adam!  Thanks for sharing it.   :)

Top 200 Contributor
Posts 22
SunBurn_Community_Licensee

Awesome, thank you!!

Top 75 Contributor
Posts 85
SunBurn_Community_Licensee
SunBurn_Pro_Licensee

Oh nice! Thanks for that!

Top 10 Contributor
Posts 6,174
Employee
SunBurn_Pro_Licensee
SunBurn_Studio_Licensee

Wow awesome trick Adam!  I'll pin the thread, so this information isn't lost.

Follow me on Twitter – development and personal tweets
Awesome XNA Videos – Lighting, Rendering, and game videos

Top 10 Contributor
Posts 708
SunBurn_Community_Licensee
SunBurn_Contributor

Nice trick, Pretty cool. :)

Contributor on the SunBurn sgMotion Animation Library open source project.

Top 500 Contributor
Posts 11
SunBurn_Community_Licensee

Slick!

Top 150 Contributor
Posts 35
SunBurn_Community_Licensee

I am testing using ClickOnce to install my app. I have it mostly working. The one hitch is related to the Sunburn engine. Everything works fine when I run the app in Visual Studio. When I run the version installed with ClickOnce, I am getting an "Unhandled exception" that indicates:

"SunBurn splash screen required for rendering, please display splash screen before calling this method"

When I use the Visual Studio feature of "Attach to process...", I am attaching the process of the ClickOnce app. This allows me to step through the installed app. However, in this scenario, I am not getting that error message.

Therefore, I tried the procedure illustrated in the original post to make sure that the Sunburn redistributable dll is installed instead of the debug version. I followed all the steps indicated in the original post but still get the same error.

 

 

Top 25 Contributor
Posts 188
SunBurn_Contributor
SunBurn_Pro_Licensee
SunBurn_Studio_Licensee

Hi Scldev,

Are you deploying to a remote machine or onto your development machine?

If you just zip up the built application (without using ClickOnce), does it run on other machines when you copy it over and unzip?

 

 

Top 150 Contributor
Posts 35
SunBurn_Community_Licensee

Adam, thanks for the quick response!

I am still running it on my dev machine. I will try to run it on a clean computer at the office tomorrow. While it should be simple enough to copy over my app's assemblies, I guess i would have to manually install the XNA 4 redistributables etc. Is this correct.?

 

Top 25 Contributor
Posts 188
SunBurn_Contributor
SunBurn_Pro_Licensee
SunBurn_Studio_Licensee

Hi Scldev,

I hadn't thought about the XNA 4 redistributables.  I guess what I was getting at was trying to see if the problem was with the game itself or with the ClickOnce deployment.  So maybe make a "standard" Windows game installer (i.e. a Setup project) and include the XNA 4 redistributable and .NET with that.  I'm guessing it'll also have the "you need to show splash screen error" on the target machine.  Are you giving the splash screen a chance to run?

Top 150 Contributor
Posts 35
SunBurn_Community_Licensee

Adam

When I am running the app in Visual Studio, I a definitely calling the Sunburn Splash Screen. I only call it once at the beginning. Maybe I need to call it more then once?? Note that my app is an even driven winForms viz app and not a game eg no game loop. Maybe the splash screen needs to be called more then once in the installed version, is this possible? I guess I could test using the ClickOnce approach, along with your fix on one of the sample Sunburn game projects  and see if I am still getting the splash screen error message. Has anyone run into similar problems when trying to install a winForms type of SunBurn project?

 

Top 150 Contributor
Posts 35
SunBurn_Community_Licensee

Adam

After further investigations, I realized that I was only calling the splash screen code once. While this worked in Visual Studio, it failed when running the "compiled" version. I changed the code such that the other SunBurn calls are not done until the SplashScreen.DisplayComplete is True. I basically added a loop on that variable. It now works. It turns out that it was not a ClickOnce issue at all!

 

Top 150 Contributor
Posts 35
SunBurn_Community_Licensee

Adam

How do I get the xna content files to be included in the ClickOnce files? Currently, the clickOnce is working except that when I run my app, I get an error message saying that an xna/sunburn effect file could not be found. I checked the click once deployment folder and could not see any of the content pipeline files. Am I missing a step in the process?

 

Top 25 Contributor
Posts 188
SunBurn_Contributor
SunBurn_Pro_Licensee
SunBurn_Studio_Licensee

For a standard XNA/SunBurn app being deployed via ClickOnce, you don't need to do anything out of the ordinary to have content files included.  It'll just happen automatically since the application that you are deploying has a reference to your content project.

For a WinForms-based XNA/SunBurn application, which does not reference an XNA content project, you need to set the Build Action property of each content file to Content:

The effect that this will have is to include that file in the Application Files window:

You can see an example of the solution setup for a ClickOnce-deployed XNA WinForms app at:
http://xnamodelviewer.codeplex.com/

Page 1 of 2 (19 items) 1 2 Next > | RSS