Pergunta

I am attempting work on a solution within Visual Studio that was originally created and managed within MonoDevelop.

The projects within the solution have a slightly different folder structure to the more traditional sense. The source files for each project are grouped within sub folders titled 'src'. For example:

MyProject
|   MyProject.csproj
|   ReadMe.txt
|
+---src
    |   Class1.cs
    |   Class2.cs
    |   Class3.cs
    |
    +---Helpers
    |       Helper1.cs
    |
    +---Utils
            Utils1.cs

As you can see, the project file lives within '/MyProject', but then all the source files are within the '/MyProject/src' folder.

When I open the project within Visual Studio, the 'src' folder is included as a part of the path for each of the files.

This is causing me problems, as Visual Studio is now using the src folder within namespacing of resource files.

However, when opened in Mono, the 'src' folder is ignored and is rather taken as the root folder for the project.

I opened the 'MyProject.csproj' and it has a property of 'BaseDirectory' with the value 'src'. I believe this property may be providing the configuration that Mono needs in order to redefine the root folder of the project. This isn't working for Visual Studio though.

I can't change the directory structure at all as the build system for the project depends on it.

Does anyone know of a way I can provide a custom definition of the root folder for a project for Visual Studio?

Foi útil?

Solução

There really isn't a way to do this in Visual Studio. It will always consider the path of source files as they exist relative to the project file in which they are included

Outras dicas

This might not be quite what you are looking for but it helped me with my issue, I included this in the relevant function that I needed it...

Directory.SetCurrentDirectory(string)

https://learn.microsoft.com/en-us/dotnet/api/system.io.directory.setcurrentdirectory?view=netcore-3.1

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top