954,560 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Refer to other project folder in a single solution

Hi
I have a solution file that consist of two different projects.
In one of the projects i have a code to upload the file and save it.

Currently the file is saved in same project directory that consist of code to upload the file.

I want to upload the file in other project directory.

Is it possible.

I am developing the application in asp.net mvc.

Please help

nccsbim071
Junior Poster
130 posts since Jul 2009
Reputation Points: 35
Solved Threads: 6
 

Hello there

If i understand you correcly!!!
suppose you have classes class1 & class2 in each project A & Project B

if you want to use class1 of project A in Project B's class2
Then right click on project 2 >> References>>Add Reference>>"Select Class1 dll of project A"

Then in class 2 of project B inherit like the class1 like this
VB

Imports Project1.Class1


C#

Using Project1.Class1


Mark as solved if it helps you!!!

reach_yousuf
Junior Poster
195 posts since Sep 2007
Reputation Points: 12
Solved Threads: 38
 

the conditon is as you have said. but i have image upload code in a project A, i want to save the uploaded image to folder in projectB.

It's not about class, that i know just adding the reference will do, but this is something different.

nccsbim071
Junior Poster
130 posts since Jul 2009
Reputation Points: 35
Solved Threads: 6
 

Ok i solved the problem:

1. string temp = Server.MapPath(Request.ApplicationPath);
2. string tempPath = Path.Combine(temp.Substring(0, (temp.Length - 21)), "IManageProject\\Images");
3. filePath = Path.Combine(tempPath, Path.GetFileName(fileName));
4. file.SaveAs(filePath);

I i just got the path to the root of the project using the code in line 1.
Then is used the substring on temp variable and got the path to the root and then finally combined it with the path to the folder i wanted.
and save the file.

nccsbim071
Junior Poster
130 posts since Jul 2009
Reputation Points: 35
Solved Threads: 6
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: