0
votes

One of our customers uses Visual Studio Online which is based on capabilities of Team Foundation Server (TFS)

We were researching how to do automated Builds and automated Unit Tests using the Visual Studio Online hosted build agent.

We are trying to build one of our Web Applications on it.

Our Web Application solution contains a number of csproj files under the solution.

Note: The Web Applications will build properly and run properly on our local development computers using Visual Studio 2012.

However, when we build the web application on the Visual Studio Online's Hosted Build Agent, it throws the following error about not finding the my application's main dll( my application is called BlahBlah ):

C:\Program Files (x86)\MSBuild\Microsoft\ VisualStudio\v11.0\WebApplications\Microsoft.WebApplication.targets (182): Could not copy the file "bin\BlahBlah.dll" because it was not found. C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft.WebApplication.targets (182): Could not copy the file "bin\BlahBlah.pdb" because it was not found.

Therefore, I checked the various csproj files within our Web Application solutions, and I found the following code:

<Content Include="bin\BlahBlah.dll" />
<Content Include="bin\BlahBlah.pdb" />

In order to make it run properly on the Visual Studio Online's Hosted Build Agent, the above references were replaced by the following:

<Content Include="bin\BlahBlah.dll"  Condition="$(IsDesktopBuild) == true" />
<Content Include="bin\BlahBlah.pdb"  Condition="$(IsDesktopBuild) == true" />
<None Include="bin\BlahBlah.dll"   Condition="$(IsDesktopBuild) != true" />
<None Include="bin\BlahBlah.pdb"   Condition="$(IsDesktopBuild) != true" />

After replacing the references, our application would build properly on the Visual Studio Online's Hosted Build Agent.

However, Should I Exclude references to the bin..project..dll in TFS or Visual Studio ONline Builds? In other words, is my above successful build a "False Pass" ?

1
Preferably you'd include these as NuGet Package References, so that VSO can pull them in during the build.jessehouwing
Sorry, I should have mentioned my application is called BlahBlah. Therefore, the Visual Studio Online's Hosted Build Agent is complaining about Not finding the application's own dll file. The application's own dll won't be in the packages folder. Do you follow?CS Lewis
But those should then be project references, not content includes.jessehouwing

1 Answers

4
votes

You should never reference any file in the bin or obj folders and you should never check any files in either into source control.

If you have dependencies between projects in the same solution then you should all a Project reference. Right click on your project and select add reference then select the Project tab.

If your dependencies are in a different solution then you should publish the bits that you wan lt to take a dependency on as a Nuget package locally. You can then use the Nuget Package Manager to take a dependency on that by right-clicking and selecting manage nuget packages.