Solved

Refer to same SubFolder from 2 projects in One Solution Solution

Posted on 2013-12-09
5
179 Views
Last Modified: 2013-12-10
Hi:

I have a .Net Application in which I have a common library and 2 projects - one in Visual Basic and the other in C#.  The Visual Basic project is basically the C# project that has been translated into VB.  Depending on the language that is used by my clients, they set the start-up project to the VB or C# project.  

Both of these projects have a SubFolder called Courses - which contain a bunch of courses that are not part of the code but which are launched by the app.

Here's what the solution looks like:

My Solution
	MyCommonLibrariesProject
	VBProject
		VB Code Stuff
		Courses
			Course 1
			Course 2
	C# Project
		C# Code Stuff
		Courses
			Course 1
			Course 2

Open in new window


I was wondering if there was a way where I didn't need to make an exact copy of the fairly large Courses Directory in both projects - but could have both projects refer to the same subdirectory  e.g.  launch "~/Courses/Course1"

Any help greatly appreciated.

RBS
0
Comment
Question by:RBS
  • 2
  • 2
5 Comments
 
LVL 39

Expert Comment

by:Kyle Abrahams
ID: 39706900
You can have an app.config which your application could then reference.  

Or if you know where your EXE is going to live you can using something like:
string folder = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName) + @"..\..\Courses\";
//assuming your in the debug / release folder
//.. = bin
//next .. = Project folder
//go down to courses.
0
 

Author Comment

by:RBS
ID: 39707789
Hi - I'm sorry but I don't understand what you mean by "you can have an app.config which your application could then reference".  This is web application so there is no exe file.

RBS
0
 
LVL 40
ID: 39707978
.NET is a very large topic. Put ASP.NET in your topics. This will tell that this is a web application, and attract experts that are interested in answering web questions.
0
 
LVL 39

Accepted Solution

by:
Kyle Abrahams earned 500 total points
ID: 39708699
Move courses to be a sibling of the C# and Vb.Net Project.

Within the web.config of each app you can reference the directory.


<appsettings>
<add key="CoursePath" value="~/../Courses/" />
</appsettings>


Then in your code:
Response.Redirct ( String.Format("{0}{1}", ConfigurationManager.AppSettings["CoursePath"].ToString(), "Course1");  //change to a param for different courses
0
 

Author Closing Comment

by:RBS
ID: 39709001
Thanks, that was helpful.

RBS
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now