PDA

View Full Version : are you missing a using directive or an assembly reference?


Albert
08-23-2006, 10:57 AM
My solution has many projects having project references to other projects in my solution. The solution builds successfully when built from Visual Studio 2003 and also from Visual Build Pro 6.1. However, while building projects individually (in the correct order of dependency of course) in Visual Build Pro, once I reach the first project that has a project reference to a previously build assembly I get the following Error:

8/23/2006 11:38:03 AM: Building project step 'Build Utility'...
Pre-processing...

Building configuration 'Release'...

Microsoft (R) Development Environment Version 7.10.3077.
Copyright (C) Microsoft Corp 1984-2001. All rights reserved.
------ Build started: Project: Utility, Configuration: Release .NET ------

Preparing resources...
Updating references...
Performing main compilation...
C:\Documents and Settings\Albert\My Documents\Visual Studio 2003 Projects\The Sporn Group\Visual Build Pro\Source\Utility\TimeUtil.cs(2,7): error CS0246: The type or namespace name 'Web' could not be found (are you missing a using directive or an assembly reference?)
C:\Documents and Settings\Albert\My Documents\Visual Studio 2003 Projects\The Sporn Group\Visual Build Pro\Source\Utility\TimeUtil.cs(3,7): error CS0246: The type or namespace name 'WG' could not be found (are you missing a using directive or an assembly reference?)
C:\Documents and Settings\Albert\My Documents\Visual Studio 2003 Projects\The Sporn Group\Visual Build Pro\Source\Utility\TimeUtil.cs(5,7): error CS0246: The type or namespace name 'WG' could not be found (are you missing a using directive or an assembly reference?)

Build complete -- 3 errors, 0 warnings
Building satellite assemblies...
Satellite assemblies could not be built because the main project output is missing.


---------------------- Done ----------------------

Build: 0 succeeded, 1 failed, 0 skipped



Process completed with exit code 1
8/23/2006 11:38:07 AM: Step 'Build Utility' failed
8/23/2006 11:38:07 AM: Build ended.

Can anyone tell my why? I presume that when the project is using a relative reference and that as long as the dependent project is in the same relative location it will find the dll. In my case that would be something like ..\<dependent project dir>\obj\release\<ass.dll>

Thank You!

kinook
08-23-2006, 11:53 AM
I believe that you must use file references in order to build an individual project that references other assemblies. See here for more details:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/tdlg_ch3.asp

This FAQ may also be helpful when using file references:
http://www.kinook.com/Forum/showthread.php?threadid=1348

Albert
08-24-2006, 02:21 PM
Well, I don't want to give up the convenience of having project references in my projects but I do want the ability to build my projects individually. I need that granular level of control to support incremental builds. Anyway, I came up with this function and it seems to be working fine.

Thanks for all your help Kinook Administrator who ever you are. Attached is an example.

Please keep in mind that I wrote this very quickly and it will work fine if your project meets the following criteria:

1. VS.NET Project files are in individual folders are siblings on the file system.
2. You are always building in Release configuration.
3. Your output assembly name has the same name as your project.

The actual function is in the Project scripts. The Script step that you see calls it. In order to use it open the script step and modify it by including your project file's path.

That's it! Feel free to tweak it to meet your needs.

Enjoy!