Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > XML Stylesheet in my Windows Form Application
 

XML Stylesheet in my Windows Form Application

Hi,
I have a function in my windows form application to transfer the data from a dataset to an Excel spreadsheet,I used XML transform, and have a XSL in my application, when developing the application, I load the XSL file from my C drive: xsl.Load("c:\mystyle.xsl").
Then I am using ClickOnce to deploy my application. And when I run the export function, error happened and it says can not load the stylesheet. Then I changed C to application path-System.Application.Info.DirectoryPath, still can not fix the problem.
I realized that file is not installed by ClickOnce? If I want to include this file when install on user's desktop, can I still use ClickOnce? If I can, how do I do that? And in my application, where should I put it and how do I refer it in my code?
I checked the article in MSDN: How to include a Data File in a ClickOnce Application, but I have problem with that too: I can't find a application directory with the current version? and in my application solution, I have four projects,this Export function is in the Utility class library project?

Please, could someone help me with this?
Thank you very much!!
I am using Visual Studio 2005.

Sophie
2009.08.12

  • Moved byCindy MeisterMVPWednesday, August 12, 2009 11:01 PMnot about VSTO technology (From:Visual Studio Tools for Office)
  •  
Xiaoci  Wednesday, August 12, 2009 3:41 PM
Add the file to your project. In the properties, set build action to "content" and "copy to output directory" to "always".

Then under the Publish tab in the project properties, click on Application Files, and find the file. Change it from Include(Data) to Include(Required).

By default, ClickOnce sets XML files to be data, and puts them in an entirely different location than the assemblies.

If you include this in the top level of your project, you can find it by looking for

Path.Combine(System.Windows.Forms.Application.StartupPath, "myfilename.xml");

If you put it in a folder under your project, just append the folder to the startup path.

RobinDotNet
Click here to visit my ClickOnce blog!
RobinDotNet  Thursday, August 13, 2009 1:17 AM
Hi Sophie

Your problem has nothing to do with VSTO. What VSTO is you can find out in the forum's Please Read First message. This needs to be asked in a forum that specializes in deployment issues, I think. I'll try to move it to the right one...
Cindy Meister, VSTO/Word MVP
Cindy Meister  Wednesday, August 12, 2009 10:58 PM
Add the file to your project. In the properties, set build action to "content" and "copy to output directory" to "always".

Then under the Publish tab in the project properties, click on Application Files, and find the file. Change it from Include(Data) to Include(Required).

By default, ClickOnce sets XML files to be data, and puts them in an entirely different location than the assemblies.

If you include this in the top level of your project, you can find it by looking for

Path.Combine(System.Windows.Forms.Application.StartupPath, "myfilename.xml");

If you put it in a folder under your project, just append the folder to the startup path.

RobinDotNet
Click here to visit my ClickOnce blog!
RobinDotNet  Thursday, August 13, 2009 1:17 AM

You can use google to search for other answers

Custom Search

More Threads

• ClickOnce deployment to multiple sites
• *URGENT* Setup And Deployment Project In Visual C# Express
• Setup Project Bug?
• ClickOnce deployed app doesn't update automatically after renewing code signing certificate
• Failed to sign
• Installation process restarts after installation is complete
• ClickOnce - Don't Add To The Start Menu?
• Error on installation folder manual change
• Bug in "Installation Folder" user interface dialog of setup project
• How to prevent uninstallation of a DLL if it was not originally installed