简体   繁体   中英

Project Dependencies in Visual Studio

I have a three projects in the solution WinSync. I have WinSyncGui, WinSyncLib and Setup. WinSyncGui requires files from WinSyncLib. How can I get it to include WinSyncLib in WinSyncGui?

VS complains The type or namespace name 'WinSyncLib' could not be found (are you missing a using directive or an assembly reference?)

I've set the dependencies so that WinSyncGui depends on WinSyncLib (so Lib is built first), but it's still not working.

Right click your project (WebSyncGui) and select Add Reference, Projects tab, and then select the project you need to reference.

You need to add WinSyncLib as a reference in your WinSyncGui project.

Adding a project reference.

I've set the dependencies

That sounds wrong. Did you set the "dependencies" or did you set the "references". Dependencies just determine build order, references are used to link projects.

Are you sure all of the types are public? if you omit the modifier, it's internal by default.

Right click on solution, choose Project dependencies and set dependencies whatever you want. It's useful, for example, when you have two exe files in one solution. It's bizzare to add another exe as reference, so I use this option to firstly build depended executable, and then post-build event is copying it into target directory. Very useful toy.

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM