views:

1331

answers:

3

In Visual Studio website projects (in Visual Studio 2005 or later, not web application projects where there is still a .csproj file) how is the reference information stored, and is it possible to source control it without storing compiled binaries in source control?

If you right-click on a website project and select Property Pages, the first screen (References) lists all the project references.

System.* references are listed as type GAC, and other DLL files can be listed as BIN or Project.

The problem occurs when you include something as a project reference, and then commit it to source control (for us, Subversion, ignoring .dll and .pdb files.)

Another developer gets updated code from the repository and has to manually set up all of these project references, but I can't even determine where this information is stored, unless it's in that .suo, which is NOT source-control friendly.

+4  A: 

If you reference a .dll by file name through the browse tab, there should be a .refresh file created (nested under the dll in BIN). We put those in SVN and it works great (you may have to hand edit them to use relative paths).

References added from the .NET tab are added to web.config

Project references are stored in the solution (.sln) file. Open the .sln file and you'll see them listed:

Project("{xxxxxxx-7377-xxxx-xxxx-BC803B73C61A}") = "XXXXXXX.Web", "XXXXXXX.Web", "{xxxxxxxx-BB14-xxxx-B3B6-8BF6D8BC5AFF}"
    ProjectSection(WebsiteProperties) = preProject
     TargetFramework = "3.5"
     ProjectReferences = "{xxxxxxxx-C3AB-xxxx-BBED-2055287036E5}|XXXXXX.Data.dll;
            ...
John Sheehan
A: 

I use copyprojectDll.ps1 powershell.

My folder structure is below

  • ClassLibraries
    ThirdParty
    Website/Bin
    CopyprojectDll.ps1
    Website.sln

ClassLibraries are code classes for my project, DAL .. Website project includes only web files, aspx, aspx.cs .. ThirdParty are required libraries, AjaxToolkit etc.

I compile ClassLibraries.sln I run CopyprojectDll.ps1 I use Website.sln after this.

Sample powershell file is below.

$folders = @(); $folders +="IB.Security" $folders +="ClassLibraries/Core.Classes"

function CopyDllsToWebBin($dll_files) { if ($dll_files -eq $null) { return; } $targetfolder = "./Kod/bin/"

foreach($dll in $dll_files)
{

 copy-item $dll.FullName -destination "$targetfolder" -force #-Verbose
}

}

function CopyDllsToThirdParty($dll_files) {

$targetfolder = "./ThirdParty/"

foreach($dll in $dll_files)
{
 copy-item $dll.FullName -destination "$targetfolder" -force #-Verbose
}

}

$dll_output_folder = "/bin/debug";

foreach($folder in $folders) { $dll_files = Get-ChildItem -Path $folder$dll_output_folder -include *.dll -Recurse | sort-object Name CopyDllsToWebBin($dll_files) $dll_files = Get-ChildItem -Path $folder$dll_output_folder -include *.pdb -Recurse | sort-object Name CopyDllsToWebBin($dll_files) $dll_files = Get-ChildItem -Path $folder$dll_output_folder -include *.xml -Recurse | sort-object Name CopyDllsToWebBin($dll_files) "Copied $folder$dll_output_folder"

}

$dll_files = Get-ChildItem -Path "ThirdParty" -include *.dll -Recurse | sort-object Name CopyDllsToWebBin($dll_files) $dll_files = Get-ChildItem -Path "ThirdParty" -include *.pdb -Recurse | sort-object Name CopyDllsToWebBin($dll_files) $dll_files = Get-ChildItem -Path $folder$dll_output_folder -include *.xml -Recurse | sort-object Name CopyDllsToWebBin($dll_files)

"Copied ThirdParty"

date

Atilla Ozgur
A: 

I realize this question is pretty old now, but in case someone comes across it later, I also have a blog post about this:

Understanding References in Web Site Projects

rally25rs