Determining whether a file is linked to a project or not - vb.net

I'm writing a project documenter and I write out the full file path of each compiled file. This is for the VB.NET language so .proj files are written in xml.
Any file that is linked to the project exists on the same drive so at least one of the directory levels are the same for all files. I currently have it set up to put the project directory path on files which exist inside the project since it only shows the name of the file and the residing directory it lives in if its in a directory inside the project. For files outside (linked in) to the project I initially saw their files paths were "..\..\..\dir\filename". So I set it up to take off all the "..\" and put the necessary directories in front of it and all that worked fine. Now for this one .proj file some of the linked in files have their full file path with no "..\".
How can I properly distinguish these three possible inputs?

System.IO.Path.IsRooted will tell you whether a path is rooted, i.e. is a full path, or not. If the path is not rooted it is a relative path. You can use Path.Combine to resolve the full path from a relative path.

Related

I cannot install PhpWord Yii

I have tried to install PhpWord to yii. I have downloaded zip file and extracted it into extentions folder:
extenstions
--PHPWord
--PHPWord.php
However, I cannot make it to run. I got following error:
include(PHPWord.php): failed to open stream: No such file or directory
How can i solve it?
After extracting the file in extension folder, you have to import that file in controller.
Yii::import('ext.phpword.PHPWord');
First of all, you didn't say if it's Yii 1 or 2. They have different autoloading methods.
Second, you have extracted it into extension folder, and I assume your file where you want to include it is in a completely different folder.
You should do it like this
include('/full/path/to/PHPWord.php');
You need either absolute or a relative path to the file (I suggest using abosulte path (the one I used as an example).
Relative path means the path to the file you want to include compared to where your file, in which you are including it, is.

Where can I find the rootfolder for my VB.net project

I am making a project that will be put on a disc to use. This means that all of the files that I call upon have to be on that disc. How and where do I put my files to ensure that they will stay with the project? Does it go in the bin folder? And when I am calling on that file what file path do I use?
In general, the bin folder is not a place you should be storing anything that you want to persist with the project.
When you build, Visual Studio will copy the files needed to run the program into the bin folder, such as libraries and web.config or app.config files.
For other files you want included, add them to your project and set their build action property to Content:
Content - The file is not compiled, but is included in the Content output group.
For example, this setting is the default value for an .htm or other
kind of Web file.

How to build resource files in to dll while maintaining their folder structure?

Is there a way to build a folder containing various resource files into a dll? The folder may contain sub-folders, and I want to keep the folder structure of these files so that I can access the files from the dll with relative path.
I'm using visual studio but it seems I can only add a resource file without sub-folders. Can you give me some suggestion on this problem?
Thanks.

How can we access the files in the Data Folder when we publish the Vb.net application

I have added some files that I need to be downloaded to the Application start up path. So I set Build Action as content now the files have been copied some where
C:\Documents and Settings\TestUser.ANNAM\Local Settings\Apps\2.0\Data\HVDRBMY5.8AA\858AT9VM.TNP\test..tion_2d7cfc137d9c2c74_0001.0013_432bd4561850d290\Data
How can access file from the application. My problem since it is a dynamic path will it be same folder count so that we can use like ..\..\Data\ Some think like this
Application.UserAppDataPath gets the path for the application data of a user.
Application.StartupPath gives you the path for the executable file that started the application, not including the executable name.
Starting with one of these, you should be able to use System.IO to manipulate the paths until you get the folder where your data files are.

How can I filter which files are included in a workspace using MSBuild?

It seems that MsBuild creates a folder called, "BuildType" on the build server and this folder is where the .proj file is copied. In source control I have several files that are in the same folder as the build project file. I have a workspace mapped to this location.
I would like to be able to specify explicitly which files from this workspace location should be copied to the build machine. Is this possible?
Thanks!
You cannot do this on file level but if you organize your build type folder with subfolders you can cloak the folders that you want to exclude.