How do i navigate through folders in code behind? - vb.net

I need to address a file in my code. this file isn't located in my main project, but in a library project. When i call AppDomain.CurrentDomain.BaseDirectory, i end up in the start project's (let's call it mainproject) debug folder. What i want to to is call appdomain.cd.bd and go up 3 levels, so i leave debug, then bin and then mainproject. Then i would navigate to libraryproject and to folder where file is located.
What i've tried so far is do AD.CD.BD\..\.. or AD.CD.BD/../..
I thought i remembered those, but it's a no go.
Does anyone know how to do this.
Thanks in advance

It is concerning to see you wanting to codify paths based on project build paths. What happens when you release the project and these project directories don't exist.
I would recommend that if there is a file your project needs to execute is from a library project that doesn't get copied across during the build that you use a post build step to copy this file to the same location as your assembly. Alternatively you may be able to set the build action on the file in your project which might get this file to your main project build output directory.

Three levels up would be ../../../ wouldn't it?

Related

IntelliJ IDEA - Directories appearing in Project Files but not in Project

So I created an empty project, but when I create a new directory in the Project window, it does not show up. The directory is actually created, and if I navigate to the Project Files list I can see it there, but as far as I can tell there is no way to make even my src folder part of the actual project. This creates all kinds of problems when I have to move/refactor files, and I'm amazed that something so common and simple is so difficult.
You've created a folder, not a package. If ur using maven or grade, can I suggest u use them to generate an intelij project for you. The command escapes me but a quick Google should tell you
You can manually mark your directory as a sources root:

Can CLion project files be stored in a specified folder by default?

I've been using CLion for a little while now, and I quite like it, except that it stores it's prject files by default in my CMake project. I am wondering if I can set a default place it stores it's project files(like compiled executables) in specific directory, per project.(So not one big folder that might interfere with other projects). The reason I want to do that is because I don't like having it in my git project(yes, I know about .gitignore) Anyone know how to do that?
Thanks!
To use a different folder for CLion building
In the CLion menu:
Build,Execution,Deployment -> Cmake -> Generation Path
Change the value to the folder path you want.
To include source code from a different folder out of current
In your CMakeLists.txt, add subdirectory like following:
add_subdirectory(<PATH_OF_YOUR_ANOTHER_CMAKE_PROJECT>)
Be aware PATH_OF_YOUR_ANOTHER_CMAKE_PROJECT can be anywhere on your computer, which does not have to be in your current project folder or one of the sub-folders.

SBT is loading project definition from wrong location

When starting SBT I see
Loading project definition from /Users/shruti/.sbt/0.13/staging/0156a9e3df5385400375/xyz/project
which is not where my project is located. (I wouldn't care, but the changes I make are not being reflected in this copy.) I searched my entire project but this path is not defined or written anywhere, neither in scalaopts. A grep over all files doesn't work either.
Does anybody know where this path is defined or how to change it?
Thanks!
sbt uses the staging area when the folder containing the project is not read/write. Making the project folder read/write should fix this.

How do I set up the MSBuild script to use the outdirectory's set in the csproj files while building the entire solution?

I'm not sure how I can get the MSBuild script to use the outputpath, outputdirectory values from the CSproj files. I've seen examples where I set the outputpath in the MSscript but that dumps the all the output in one big folder. I want the individual projects to have their own output paths and MSbuild to build the solution in such a way that the output for the projects and created in the corresponding output directories. Thanks.
There is not an easy way. One option is to extend MSBuild and have it copy the output from each project to a common folder.
If you look at the Microsoft.Common.Targets file in the c:\Windows\Microsoft.Net\Framework\v4.*\ you can see how it does load a custom targets file at both the beginning and end of that folder. If you add a Custom.After.Microsoft.Common.Targets to the C:\Program Files (x86)\MSBuild\v4\ folder you can have it load a file say $(SolutionDir)\Solution.targets. This will allow you to extend each solution differently and you can add any custom actions you want inside every solution that applies to every project. I use this and it works great.
Thanks for your answers guys. I found a way to run the solution without giving a specific output folder. I had to fix the output folder path to /bin in the csprojs and then running MSbuild with the solution was able to pick up those paths from the csprojs and build the output into those folders.

Remove the PDB file/functionality from Lib

I'm stuck in the following situation, I have been asked to rebuild a website, the original site was built and the solution had 5 projects, 4 of these where the different data layers and one of them was the actual website.
I only have the dll's of the 4 projects, so far I've managed to rebuild the website and adding the dll's to my project gives me access to the Entities and Repository layer etc... everything builds fine.
The problem is that when I run the project the debugger is trying to look for the Source files of the dll's that I've added which I don't have. Is there a way to remove the PDB file/functionality from the dll's that I've added? I don't need to or want to debug those dll's as I know that they are working correctly... and I dont have the code to change them if they arent.
Or to ask it in another way, is there a way to add them to my project and force them to not run with the Debugger?
Thanks
Ok, so to solve this problem I had to decompile the lib's of the four projects, create and place the code files in the exact directory that is specified in the PDB files and then compile and run the website.
I dont think it cared that the source files didn't compile again, it just needed to know that they where there.
After running the site i could delete the created path and source files and I haven't had a problem since.