Two projects in a solution that use different default paths

visual studio default build output path
visual studio+change output directory for all projects
visual studio default output path
visual studio multiple projects one solution
visual studio build output path
visual studio output path variable
place solution and project in the same directory meaning
should i place solution and project in the same directory

I have two projects in my solution, ChatProject and ChatProjectTest.

ChatProjectTest has a single class file that has many methods that test methods in ChatProject.

My problem is that ChatProject uses some files, like data.bin and log.txt, that are stored in the .exe folder (that is ChatProject\bin\Debug\ChatProject.exe). I want ChatProjectTest to use the same files, and not go ahead and create or load new files in its own .exe folder (ChatProjectTest\bin\Debug\ChatProject.exe), like it does currently.

To be clear, the file paths are stored in constant variables in ChatProject like this:

private static string DATABASE_NAME = "data.bin";

I didn't hardcode their paths.

One solution can be configuring your projects to put all the output files into the same the same bin/ directory under your solution root (instead of two separate bin/ folders). To do this, go to the "Build" tab under project settings and set "Output path" to

$(SolutionDir)Bin\$(Configuration)\

Repeat this for both of your projects.

1. Solutions and Projects, However, projects can belong to multiple solutions, as Figure 1-2 shows, which gives The simplest is to create a new project—by default, Visual Studio . You can use the Location text box to choose the path for this New Solution Name and​  For instance, when working on a project in one folder that utilizes shared code held in a different folder, you can now open both the project folder and the shared folder in the same window. To do this you use the Add folder to Workspace command. VS Code then saves this configuration in a new file with a .code-workspace extension. If you double-click that file, VS Code will re-open with both folders present.

If you don't specify a path to a file it looks in the current directory for them. To use the same ones, you either have to specify some sort of relative path from the Test Output, or build the tests into the same folder as the Project.

How to build all projects in one single folder?, You can set output directory in the settings of every project in solution (if directories only once, and use those settings in multiple projects. You can change projects "Output path", by default it's bin directory of given project. At the directory level of your solution, add a svn:externals property pointing to the projects you want to include in your solution. Subversion will pull the project from the repository and store it in a subfolder of your solution file. Your solution file can simply use relative paths to refer to your project.

You may allow the target file path to be injected e. g. via an optional constructor parameter:

public class SampleClass
{
    private readonly string OutputDirectory;

    public SampleClass(string outputDirectory = ".")
    {
        OutputDirectory = outputDirectory;
    }

    public void WriteData(string data)
    {
        File.AppendAllText($"{OutputDirectory}\\data.bin", data);
    }
}

[TestClass]
public class SampleClassTest
{
    [TestMethod]
    public void WriteDataTest()
    {
        var sut = new SampleClass("..\\..\\..\\ChatProject\\bin\\Debug");
        sut.WriteData("data");
    }
}

Professional Microsoft SQL Server 2008 Reporting Services, By default, new solution and project folders are stored under the path in the and the project differently, especially if my solution will include multiple projects. to the inside edges of the main application window or set to float independently​. Project file. Visual Studio uses MSBuild to build each project in a solution, and each project contains an MSBuild project file. The file extension reflects the type of project, for example, a C# project (.csproj), a Visual Basic project (.vbproj), or a database project (.dbproj).

Professional Microsoft SQL Server 2016 Reporting Services and , I usually use a name that briefly describes the purpose of the project and that I will recognize later. Note the default project folder path. In larger, full-scale solutions that include multiple projects, you might name the solution something like  Visual Studio can find an assembly when given a path to the project. When you have a project that produces an assembly, you should reference the project and not use a file reference (see below). The advantage of a project-to-project reference is that it creates a dependency between the projects in the build system.

<solution> Task, NET solutions (or sets of projects), automatically determining project For example: if you want to be able to build a project both as a . the task to use WebDAV for retrieving/compiling the projects within solution. The default is false. includevsfolders, bool, Includes Visual Studio search folders in reference search path. To open the project's property pages, right-click on the project node in Solution Explorer and select Properties. Select the appropriate tab based on your project type: For C#, select the Build tab. For Visual Basic, select the Compile tab. For C++ or JavaScript, select the General tab.

Pro NuGet, Some commands will use the current directory where the nuget.exe tool is Because the NuGet command line has no context for the solution or projects you might to <path to your solution>\packages, which is the default configuration for NuGet allows you to use multiple versions of a package within the same solution. Adding projects is fairly simple—right-click on the solution in the Solution Explorer, and select Add → New Project to bring up the New Project dialog box, select the type of project you want, and then give it a name. You can also use Ctrl-Shift-N to bring up the New Project dialog box.

Comments
  • It's not clear to me if you want this to work at run time or compile/build time? For compile time, you could add the file as a link to the ChatProjectTest