Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access the files in bin/debug within the project folder in Visual studio 2010?

Tags:

I have my docx.xsl file in my project/bin/debug folder.Now i want to access this file whenever i needed.But i could not able to access this file.

 WordprocessingDocument wordDoc = WordprocessingDocument.Open(inputFile, true);  MainDocumentPart mainDocPart = wordDoc.MainDocumentPart;  XPathDocument xpathDoc = new XPathDocument(mainDocPart.GetStream());  XslCompiledTransform xslt = new XslCompiledTransform();   string xsltFile = @"\\docx.xsl"; // or @"docx.xsl";   xslt.Load(xsltFile);  XmlTextWriter writer = new XmlTextWriter(outputFile, null);  xslt.Transform(xpathDoc, null, writer);  writer.Close();  wordDoc.Close(); 

Please Guide me to put correct valid path to access docx.xsl file...

like image 781
Saravanan Avatar asked Aug 18 '11 09:08

Saravanan


People also ask

What is bin Debug folder?

The bin folder holds binary files, which are the actual executable code for your application or library. Each of these folders are further subdivided into Debug and Release folders, which simply correspond to the project's build configurations.

How do I see all project files in Visual Studio?

Open your project in Visual Studio > click the Show All Files button > expand the bin , Debug > select and right-click the parent folder > choose Include in Project option. 4).

How do I access a folder in Visual Studio?

There are two ways to open a folder in Visual Studio. In the Windows Explorer context menu on any folder, you can click “Open in Visual Studio”. Or on the File menu, click Open, and then click Folder. Recent folders will be persisted to the MRU.

Where are Visual Studio project files stored?

When you create a new project, Visual Studio saves it to its default location, %USERPROFILE%\source\repos. To change this location, go to Tools > Options > Projects and Solutions > Locations.


1 Answers

You can determine the location of your executable, and assuming the file will be deployed with the application to the relevant directory, then this should help you find the file in debugging and in deployment:

string executableLocation = Path.GetDirectoryName(     Assembly.GetExecutingAssembly().Location); string xslLocation = Path.Combine(executableLocation, "docx.xsl"); 

You might need the following namespaces imported at the top of your file:

using System; using System.IO; using System.Reflection; 
like image 89
Grant Thomas Avatar answered Oct 13 '22 00:10

Grant Thomas