ClickOnce Deployement: Cann't resolve path for resource files.

M

moondaddy

I have a sample vb .net 2.0 winforms app and am using Oneclick deployment to
a remote server. All of the files (DLLs, EXEs, manifests, configs, etc.)
seem to get deployed to the target folder on the client OK and seem to work
OK, Except for some additional files I created for the client application.
For example, I have a file called myData.xml and myCustomConfix.xml which
the windows app uses. In the old 1.1 days (while working in the VS2003 IDE)
I put these files in the bin folder and the app would reference and use them
via a line of code like this:

Dim sMyDataFile As String = Directory.GetCurrentDirectory & "/myData.xml"
Dim sMyConfigFile As String = Directory.GetCurrentDirectory &
"/myCustomConfix.xml"

and sMyDataFile would be something like this:

"biglongpath/projectfolder/bin/myData.xml"

Then when I create an installation exe for the app and install it on the
client, all files (dlls, app files, myData.xml, and myCustomConfix.xml) are
all located in the in one single target folder on the client.

Now in .net .2.0 the path for:
Dim sMyDataFile As String = Directory.GetCurrentDirectory & "/myData.xml"
is:
"biglongpath/projectfolder/bin/Debug/myData.xml" (now in the bin/debug
folder)

and when oneclick installs in to the client all the files are installed
together under a single folder except for myData.xml and myCustomConfix.xml
which get installed in the bin/debug folder on the client.

The problem is the app still uses the same code to find those files
(Directory.GetCurrentDirectory & "/myData.xml" ) but this path resolves to
the main folder where the app exe is running and not the bin/debug folder.

Questions:

1) This seems to be a major functionality by design (how/where things run
from in the ide vs how/where the run on the client) Why isn't this better
documented on how to deal with this. I'm sure this is a common problem.

2) What is the proper way to deal with this?

Thanks.
 
G

Gary Chang[MSFT]

Hi,
and when oneclick installs in to the client all the files
are installed together under a single folder except for
myData.xml and myCustomConfix.xml which get installed
in the bin/debug folder on the client.

2) What is the proper way to deal with this?

This behavior is by design. Unlike the VS2005 setup project file, the
ClickOnce project cannot specify its application file's installation
directory explicitly. Its installation package will persist the dev
project's folder structure to the client machine. Since your myData.xml and
myCustomConfix.xml exist in your dev project's bin/debug directory, its
ClickOnce installation package will also install them into the target
application directory's bin/debug folder.

To workaround this problem, I suggest you can move the myData.xml and
myCustomConfix.xml file into the project's directory(via the Solution
Explorer) when you want to publish that application, and make sure they
have been included(Data File (Auto)) in ClickOnce project's "Application
Files" list.


Thanks!

Best regards,

Gary Chang
Microsoft Community Support
======================================================
PLEASE NOTE the newsgroup SECURE CODE and PASSWORD will be updated at 9:00
AM PST, February 14, 2006. Please complete a re-registration process by
entering the secure code mmpng06 when prompted. Once you have entered the
secure code mmpng06, you will be able to update your profile and access the
partner newsgroups.
======================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from this issue.
======================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
======================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top