ClickOnce Deployment Trick

This post has 18 Replies | 4 Followers

Top 150 Contributor
Posts 35
SunBurn_Community_Licensee

Adam

My winforms app is using a neat suggestion from JohnK that allows it to use the usual content approach and avoids the MsBuild approach. Basically, from JohnK, here are the steps:

  • Create a WinForms project (you already have this)
  • Create an XNA game library for Windows
  • Create an empty content project
  • Add a content reference in the XNA game library to the content project
  • Add an assembly reference in the WinForms project to the XNA game library

The xna game library has a reference to the content project but ClickOnce I guess is not seeing this.

In your suggestion, it looks like the raw content files are included in the deployment as opposed to the compiled .xnb files. If I include each .xnb files in my project, would that work?

 

Top 150 Contributor
Posts 35
SunBurn_Community_Licensee

I have tried adding the .xnb files directly to the main project but this does not work. I think that the XNA is expecting the .xnb files to be located relative to the XNA game library project paths. Surely, there must be a way to manually include the compiled content files to the correct folder for a proper deployment... Any suggestions?

Top 25 Contributor
Posts 188
SunBurn_Contributor
SunBurn_Pro_Licensee
SunBurn_Studio_Licensee

My guess is that trying to include the compiled files under Publish > Application Files is not the right path to go down. 

The trick is for your main ClickOnce-deployed application to have references to all of the projects that it depends on, which you've done.  You don't have a direct reference to the content project, but you do have an indirect reference it sounds like:  WinFormsApp -> XNA Game Library -> XNA Content Project.  So I'm not sure why it's not working. 

One thing to try, if it's possible, is to add a reference to the content project to your WinForms app, so it's crystal clear to ClickOnce that you're gonna need that stuff to be deployed along with the main application.

If you can post a zip of the whole solution (or a stripped down tesbed), I'd be happy to take a lot at it, and maybe that'd jog some ideas.

Top 150 Contributor
Posts 35
SunBurn_Community_Licensee

Adam

You are correct in that my winForms app has a reference to the XNA Game Library and that the latter has the reference to the XNA content project. ClickOnce does not appear to see this. Also, there does not appear to be a way to add aref to the XNA content project directly from the winForms project.

While ClickOnce appears easy to use and everything, it has some limitations in terms of flexibility. For one thing, I made a point of creating a clean plugin type of architecture for many of the components in my app. For example, the very thin winForms app does not have an explicit reference to the XNA layers but instead, has a reference to interface classes that abstract the 3D requirements. In this way, I can swap out the 3D plugin with other approaches if needed etc. My app has many other similar abstractions. When using ClickOnce, I am currently having to add direct references to a number of these plugin layers so that the files get added to the deployment. I plan on using this approach only for now to speed up testing on other clean machines. Later I guess I will need to switch to a more flexible deployment solution that will avoid hacking up my code refs in these ways.

I will try to strip down a bare bones sample that behaves in a similar manner and see if you can shed some further light on the matter. Thanks for your feedback.

 

 

Page 2 of 2 (19 items) < Previous 1 2 | RSS