I have Visual studio project about dataTier application, I prepared a project and in the same solution I have windows from application project.
I want to add as a reference dataTier project to Windows from project.
How can I do it?
Data tier Project in visual studio has no .exe or .dll file so I can not add it as a reference.
The Data tier Project will produce a .exe or .dll file if it compiles successfully on build. Looking in the Project Folder, you'll usually find it in the \bin\Debug or bin\Release subfolder (depending on which build configuration you've used).
But usually you don't want to add a reference in this way. If you right-click on a Project name in Visual Studio, you'll be presented with a menu which has an 'Add Reference' menu item. Click on this, then choose 'Projects' as the type of reference you want to add. You should see all other Projects which are included in the Visual Studio Solution. Just choose the one you want to reference and that's it.
EDIT: Ah, I realise now you're probably talking about the SQL Server Data Tier project type, which contains SQL scripts rather than compiled code so therefore can't be referenced by a C# project.
So, what are you actually trying to achieve here?
Related
I have 2 visual studio solutions. So I am working with 2 visual studio instances.
One project in the first solution is referencing to another project in the second solution.
When the dll is changed on the disc is not refreshed in my solution. I dont get all the metadata.
Is there anyway to auto load changed dlls?
Thanks
As Commented by #mcNets,
You can add two projects in a single solution & then assign
dependencies in the projects.
To assign dependencies to projects
In Solution Explorer, select a project.
On the Project menu, choose Project Dependencies.The Project Dependencies dialog box opens.
On the Dependencies tab, select a project from the Project drop-down menu.
In the Depends on field, select the check box of any other project that must build before this project does.
Your solution must consist of more than one project before you can create project dependencies.
Right click on your solution Choose Batch Build.
It will open the dialog where you can see all the projects in the solution.
Now check all the checkboxes in the build column for your project and also for the referenced project. both release and debug config.
Now click on build.
Once build is complete run your project.
Your problem will be resolved.
I previously asked a similar question regarding Visual Studio 2013 but now I'm running into the same problem with Visual Studio 2015 but it seems to work differently, which makes the previous answer not applicable to this question. This is my previous question: Visual Studio 2013 - How to debug a project within a solution
I'm attempting to add a project reference. I have a library I'm working on in a separate solution/project and a console application I want to use to test and debug the library.
I tried: Add Reference > Projects > Solution > Browse
But the open file dialog does not contain .sln files in the filter list and if I force it to display them by typing *.sln and then select the Solution I get:
"Please make sure the file is accessible and that it is a valid assembly or COM component."
What am I doing wrong? How do I properly add a Solution/Project reference?
For me issue was due to difference in Target framework. One was .NET Framework 4.5 and other was .NET Framework 4.5.2
Verify if the Target framework is same for your project and the project reference that you are trying add reference.
(Right click on project -> properties -> Application Tab(Target frame work))
Right click on your solution file in Solution Explorer window, click Add and select Existing Project...
Once the project is a part of the solution, you will be able to add project reference.
In case anyone else runs into this here is something that I found. I had almost the exact same issue in VS 2015. I created a console app and then a class library project but could not add a reference to the class library.
It turns out I didn't create a class library project as I had thought, but rather a class library (package) project. These are different things and I was unaware of what the (package) part meant when I selected it. This is for creating Nuget packages, apparently.
I'm not sure if this is something new to VS 2015 but I had not run across it before and it caused me some grief. The error message ('A reference to ClassLibrary1 could not be added') was totally worthless in trying to debug it.
You should add project to your solution first; after adding project to your solution, you can reference it.
To add an existing project to your solution:
Add reference menu:
Add references dialog:
In order to add a project reference, the project has to be part of the solution.
For me issue was due to a difference in the types of projects. One was a C# Windows forms project and the other project was a C# Universal Windows project.
The Windows Forms project couldn't reference the Universal Windows project. The error was "Unable to add a reference to project "XYZ".
It appears you can have a library shared between both types of projects by folloing this answer: What kind of class library works with both Universal and Winform projects?
I ended up having a different solution. I had three projects in the solution which referenced a NuGet package which was no longer available. I had the library locally but I was unable to add it. I found that because of the BUILD ORDER and DEPENDENCY of my projects, I had to add it to the project that was built first, then I could add it to the projects that were dependent on that project.
I had this problem today and I looked at the configuration manager for the solution. The projects had different platform settings. I made them both Any CPU and rebuilt. Then I could reference the project.
I have a Visual Studio 2012 solution that has a second dependent project that contains our Telerik reports. The main project is published to our intranet server via a network path (//servername/folder) and includes a reference to the second project. The first time I tried to publish the project, I was told the report project's DLL was missing. Once I compiled the project as "Release", it published properly. So now I manually compile the report project before publishing the main project.
I am sure VS can do this all for me, but I can't figure out how to set it up, nor can I find any documentation explaining how to do this. Can anyone send me in the right direction?
Are they part of the same solution? Did you reference the other project using the "Solution" tab of Add Reference or by using Browse?
If they're part of the same solution, right click the solution and go to Properties -- not completely sure but I'd imagine setting up "Common Properties-->Project Dependencies" would affect build order.
I have a solution with 4 projects in it.
Test.Common
Test.Controller (Controllers for the Web project)
Test.Data (EntityFramework)
Test.Web (MVC4)
When I go to add a reference to my Data layer to my Controller project and browse to my Data project's directory, should I be using the dll from the 'bin/Debug' directory or the 'obj' directory? And, does it make a difference?
Neither.
You should add a Project reference (from the Solution section)
This will make Visual Studio resolve the reference from the project system, making features like Go to Definition and automatic rebuild work.
Outside your solution, you should add from bin.
You should be adding a reference to the Project in question, not its output. There is a 'Projects' tab on the 'Add Reference' dialog.
If the project is in your current solution you can make a reference to the project (Class Library) itself. This will offload the responsibility of configuration management (Debug, Release, etc) to Visual Studio.
I am an experienced developer who is completely new to C# and windows development.
I would like to contribute to Rocksmith custom song creator with a simple feature, but I don't even know how to build and run the project in Visual Studio 2012. I cloned the git repository, double clicked on devtools/devtools.csproj then Debug -> Start Debugging but I get an error about not being able to start a class directly.
You can browse the source code of the project at: https://code.google.com/p/rocksmith-custom-song-creator/source/browse/
From what I can tell, you have selected a sub-project in your solution to be the starting-project.
See, if there is project that defines a Window (WinForms or WPF), right-click this project and select it as starting project.
From MSDN
You can specify which project or projects within a multi-project solution Visual Studio will build and debug first.
To set a single startup project
In Solution Explorer, select the desired startup project within your solution.
On the Project menu, choose Set as StartUp Project.
The .csproj is just a project, you need to put that into a Solution (or open the solution included, if any)
Do you have a .sln file? Probably that's the one you must open.