I am using PostSharp 3 Ultimate in my Azure Worker role project. I am using tfs.visualstudio.com
for the source control.
Now, PostSharp doesn't like NuGet Package Restore
. It requires us to restore all nuget packages before we build the project on the build server -- http://doc.postsharp.net/##nuget-restore
So, I followed this link (http://docs.nuget.org/docs/reference/package-restore-with-team-build) and created a .proj
file that first restores all NuGet packages and then build the solution on the build server. This approach works beautifully for my ASP .Net MVC
project that I deploy as an Azure Web Site
. But when I try to build my Azure Worker
project the same way, I get the following error:
Exception Message: Please specify a Visual Studio Solution (.sln) to build. (type BuildFromSolutionException)
Exception Stack Trace: at System.Activities.Statements.Throw.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
Here is how my solution is structured:
+ Solution
|-+ packages
|-+ Tools
| |-+ NuGet
| |-- NuGet.exe
|-+ Workers (Cloud Project)
|-+ Workers.QueueProcessor (Worker Role)
|-- Workers.Build.proj
|-- Workers.sln
Here is what is in the new Workers.Build.proj
file I checked in to the TFS:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0"
DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OutDir>$(MSBuildThisFileDirectory)bin</OutDir>
<Configuration>Release</Configuration>
<ProjectProperties>
OutDir=$(OutDir);
Configuration=$(Configuration);
</ProjectProperties>
</PropertyGroup>
<ItemGroup>
<Solution Include="$(MSBuildThisFileDirectory)Workers.sln" />
</ItemGroup>
<Target Name="RestorePackages">
<Exec Command="$(MSBuildThisFileDirectory)Tools\NuGet\NuGet.exe restore $(MSBuildThisFileDirectory)Workers.sln" />
</Target>
<Target Name="Clean">
<MSBuild Targets="Clean"
Projects="@(Solution)"
Properties="$(ProjectProperties)" />
</Target>
<Target Name="Build" DependsOnTargets="RestorePackages">
<MSBuild Targets="Build"
Projects="@(Solution)"
Properties="$(ProjectProperties)" />
</Target>
<Target Name="Rebuild" DependsOnTargets="RestorePackages">
<MSBuild Targets="Rebuild"
Projects="@(Solution)"
Properties="$(ProjectProperties)" />
</Target>
</Project>