I would like to place the C# source code (.cs) outside the VisualStudio solution folder.
This is because I want to manage some project codes in the solution separately from the main unit.
C#How do I get my project out of the solution or if it's not possible, just the source file?
source files.
I'd like to put it outside the solution folder, is there any way?
There is an existing Solution-A.
Solution-A includes 10 projects and
8 C# projects
It consists of two C++ projects.
The 10 project products will be released as a single version.
It has a unified version number and is managed by Subversion.
The folder name of Solution-A has the following folder configuration as Solution-A.
This is called the main body.
Solution-A
Yes.svn
Yes. vs.
Pro Project-1
Pro Project-2
Pro Project-3
Now, I would like to add a new project Project-11.
Project-11 is a plug-in DLL created with C#.
The Project-11 code refers to the Project-1 code, so we use the project reference.
The Project-11 product has a different version number than Solution-A.
Therefore, I would like to manage the version in a separate repository.
I thought the following folder configuration would interfere with version management in Subversion.
Solution-A
Pro Project-11
Therefore, I wanted to place the Project-11 folder outside the Solution-A folder.
(Proposal 1) Place project folder outside
Add → Existing Project
.csproj outside Solution-A, per folder
Copy under Solution-A
(Proposal 2) Leave only the cs source file outside and manage the version
Solution-A
Pro Project-11
After creating
Add → Existing items → Add as a link (select cs source)
The source file is copied to the Slution-A folder.
(Proposal 3) Devise source management in Subversion
I haven't tried it yet.
I have a plan to move to git soon, so I prioritized other methods.
"If the content is the same as it is currently written, you can specify it by right-clicking on IDE, etc., such as ""Add"" → ""Existing Projects"" → ""Existing Items"" → ""Add File Dialog Button Dropdown"" → ""Add as Link""."
The paths for the solution and project files are set as relative paths, but even if you edit them directly and change them to absolute paths, there was no problem when opening them with IDE, so you can build them.
However, depending on how it is used, it is doubtful whether they are really needed as source files.
If you want to separate them from the project code, you can build them as separate assemblies and others can use them as reference.
XY problem, so I'd like to use it for something more, so I'd like to use this folder/file configuration.It would be better to add information such as
depending on what's updated
Why create Project 11 under Solution-A?
So, just adding a subproject under the existing svn management unit called Solution-A?
I think it would be better to create a new Solution-B and create Project 11 under it.
The project or file itself is copied in both additions.
The situation has not occurred here (Visual Studio Community 2022).
(Solution-B above)
Or you may need to change the default setting or something like that for Visual Studio has different versions.
I don't remember if I changed anything, so please search for help related to Visual Studio.
Add → Existing project method will be withdrawn.
It doesn't seem to be the way I want to use it.
Stop sharing source files and browse to build result assembly
If you still share the source file, you may inadvertently edit it or use it in the middle of a revision of the original project, so you can change it to using the build result assembly.
In the Solution Explorer pane in the upper right corner of IDE, locate and specify the dll of the build result of Project 1 in Browse → Add Reference → Browse → Reference Button in Project 11.
Use Project 1 namespace on the "Project 11" source.
Why create Project 11 under Solution-A?
So, just adding a subproject under the existing svn management unit called Solution-A?
I think it would be better to create a new Solution-B and create Project 11 under it.
Any addition of the project/file will copy the project or the file itself.
The situation has not occurred here (Visual Studio Community 2022).
(Solution-B above)
Or you may need to change the default setting or something like that for Visual Studio has different versions.
I don't remember if I changed anything, so please search for help related to Visual Studio.
"Add" → "Existing project" method will be withdrawn.
It doesn't seem to be the way I want to use it.
Stop sharing source files and browse to build result assembly
If you still share the source file, you may inadvertently edit it or use it in the middle of a revision of the original project, so you can change it to using the build result assembly.
In the Solution Explorer pane in the upper right corner of IDE, locate and specify the dll of the build result of Project 1 in Browse → Add Reference → Browse → Reference Button in Project 11.
Use Project 1 namespace on the "Project 11" source.
Using this article as a reference, you can incorporate the assembly's EXE/DLL as a reference, and if you have a corresponding PDB file, you can achieve the function you want.
"Go To Definition" in Visual Studio only rings up the Metadata for Non-Project references
"However, ""Move to Definition (F12)"" from the source code is not possible."
According to this article, which I found after a series of searches, it may have been improved since 17.1 of Visual Studio 2022.
Go To Definition improvements for external source in Roslyn
At the end of this article, it says that you still have ideas for improvement and intend to continue working.
If you have a chance, please try it.
Even if it has not been realized at this point, it may be possible to respond if you submit a request.
© 2024 OneMinuteCode. All rights reserved.