I am using visual studio 2008 and I have a few files that I want to reference when in #debug mode. How do I get the directory of the workspace so that I do not have to manually change it every time I am at a different computer?
For instance, when I'm at work, my workspace is in c:\work2, when I'm at home, it is in d:\work.
This isn't an issue on the live product but it is when I change computers or other uses load the project since the files are in different directories for each workspace.
thanks!
Eroc
Add the test files (XML, spreadsheet, etc) as a 'Resource.' How to Add a Resource to your Project
Then, in your test files, you can use a relative address to access those files.
private const String = "./testFile1.xml";
You are able to have some pre-build command to change directory.
Related
I think this is a known problem with real folders and solution folders in visual studio. I'm facing now the same issue. I got a project handedover from other developer and he already created, directly under the solution some folders and sub folders. All these directories and sub directories are appearing in visual studio solution explorer and also on the file system. As I mentioned, I'm using VS 2015. Here a screenshot:
I have no idea how he did this or if he used any tool for that.
When I try to create a sub folder under SQL-Scripte folder and add some files to it, then the added files are appearing directly under the solution directory. See this screenshot:
Any help is highly appreciated :).
Thanks!
Actually the folders that you create as solution folders, are virtual ones that you cannot see on the file system. To be able to see the folders on both sides (VS and file system), I managed to fix this with the following work around:
1- Create a solution folder (let us name it newSql) under your SQL-Scripte folder
2- Add the files to it.
3- You will notice that the files are located directly under your solution folder in the file system. Exactly as you mentioned in the second screenshot.
4- Now close your visual studio and navigate to your solution directory.
5- Create under the folder SQL-Scripte (on file system), a folder named newSql and copy the files from your solution directory (in your case the SQL file that starts with 1.17....) to this newSql physical system folder.
6- Then open your (.sln) file with Notepad or Notepad++
7- Locate the entry for the new added newSql folder and there change the path to point to your new file system newSql folder. Like this: SQL-Scripte\newSql\1.17.sql
8- Save and again open VS. If you are using TFS then you should right click on the 1.17.sql file and click add to source control and check in.
Like this, you will see the folder on both sides and you can manage it only from VS.
Hope it helps.
I have a C# web application that I have developed using Visual Studio 2010 and commit changes to a VisualSVN repository using the AnkhSVN plugin for Visual Studio.
I have created a Jenkins project that checks the repository every five minutes for new commits and then builds the web application, using the MSBuild plugin, if it sees a change.
This is working fine, however it is building the application to C:\Program Files (x86)\Jenkins\workspace\[Jenkins Project Name]\[Web Application Name] and I would like it to build to D:\Web\[Web Application Name] as this is the directory my IIS site is pointing at. (Both locations are on the same server)
Is there a setting in the Jenkins project where I can change this or do I have to add a build step that copies to a different location using a batch command or something similar?
Many thanks in advance.
You can specify a custom workspace for the Jenkins job to run in.
In your jenkins job look for a button on the right hand side that is labeled Advanced. On Jenkins 2.46.1 it is at the bottom of the General section just before the SCM section of the build job. Click on it and a new set of options will appear, one of them will be Use custom workspace. Check the box and put in the path to the folder you want to use. You should ensure the Jenkins user has permissions on this folder or bad things might happen.
Note that this will perform the entire build in this folder, so anything else that is also in the workspace folder for that build job will be in the new location.
If you want just the output files without all the source and other stuff you will indeed have to add another build step (batch is one option) to copy the relevant files from your build jobs workspace (which can be accessed in batch using the WORKSPACE variable jenkins defines for the job) to the desired destination folder.
I'm writing a Visual Studio editor plugin. This plugin's functionality includes modifying the project's folder and file structure. I also need access to physical folder where the project is being held. Currently I'm getting the project folder in the following way:
EnvDTE80.DTE2 dte = (EnvDTE80.DTE2)serviceProvider.GetService(typeof(EnvDTE.DTE));
var projectItem = dte.Solution.FindProjectItem(pszMkDocument);
var project = projectItem.ContainingProject;
Then I may query System.IO.Path.GetDirectoryName(project.FileNames[0]) and get required path.
But how can I do so in case of website project in Visual Studio? Websites does not have project file as such, and the previous method returns a http:// path instead of local path.
The EnvDTE.Project.Properties collection contains a property named "FullPath" whose Value returns the physical folder for web site projects.
you can use server.mappath
HttpContext.Current.Server.MapPath("~/App_Data/Example.xml");
I created installer with setup project in visual studio 2008.
I added 2 folders (win32 & win64) with files to setup project. I want the files from win32 or win64 be placed to specific directory inside Application folder depending on CPU architecture.
By default both folders are placed into Application folder, but what I should do so only the files from specific folder will be copied?
Seems like you can simply enter the property name VersionNT64 as the Condition for including the file you want for 64 bit. I would guess you can use Not for the opposite.
As per MSDN.
I am having some issues with VS C# 2010. Upon create a project I can not seem to locate the project files after saving.
On my laptop they store to C:\Users\james\Documents\Visual Studio 2010\Projects but on my desktop they are being stored in C:\Users\james\AppData\Local\Temporary Projects\mediaplayer
I can seem to locate this folder, even when using the variable %appData%. There is no Local, or Tempory Projects folder. At least I can't see them.
I much preferred the project being stored in Documents. Is it possible to change this? If not, how can I physically access the folder with my project within it?
You can change default folder for new projects in Visual Studio settings.
Click Tools menu
Click Options
Find "Projects and Solutions"
Choose "Project location"
AppData folder is hidden. You have to type its address in address bar manually or you can enable view for hidden files in Windows Explorer.
For Visual Studio 2019 & 2017 :
Click Tools menu
Click Options
Find Projects and Solutions
Choose Locations
and edit the projects location box (the first one)
When you first fully save everything (or exit and choose to save) the project files will be saved in the expected location. It's only in a temporary location until you explicitly save.
C:Windows\Users\"username"\source\repos
this the location of all your projects.
thank you
Projects are stored in Temporary Projects under some settings only if you never save them. If you save the project (File → Save All) then you can choose where to save it. The default is the Projects folder inside your Documents.
Right-click on the tab name of any file you have open and select 'open containing folder' to get there quickly.
Just thought I'd add this as was annoyed at not seeing the file path names when a file just opens via VS by default. (eg, windows terminal app settings menu)
By default Visual Basic 2010 (Or Visual Studio) doesn't notice you when a project is backed up. You can manually check it
Project Backup Location:
You can find the project backed up in C:\Users\<User Name>\Documents\Visual Studio 2010\Backup Files hope that helps.
For you case:
Location to backup project should be C:\Users\james\Documents\Visual Studio 2010\Backup Files\mediaplayer