Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MsBuild: Do not compile referenced project

I have the following project structure:

SLN
    libA
    libB (references libA)
    exeWPF (references libA and libB)

I use NAnt to compile libA and libB, with csc, but I cannot use csc with the WPF project, XAML targets cannot be compiled with NAnt, so I use a MSBuild task inside the NAnt project.

The problem is that when I launch a complete build, libA and libB are already by NAnt, and then when the MSBuild task is launched, the libA and libB libraries are compiled again, because the exeWPF csproj file references the libA and the libB projects.

An alternative could be instead referencing libA and libB as projects, I could reference them as dlls in the exeWPF csproj file. The problem is that in this case I loose the code and, navigate to reference.

The solution for me would be to be able to specify from the MSBuild task the references to the MsBuild project.

like image 448
Daniel Peñalba Avatar asked Feb 12 '13 10:02

Daniel Peñalba


1 Answers

You can build your exeWPF project like this

msbuild exeWPF.csproj /p:BuildProjectReferences=false

Property BuildProjectReferences will prevent MSBuild from building references, it will be forced to use pre-built assemblies to extract metadata for references, and it will fail if referenced assemblies don't exist.

like image 169
seva titov Avatar answered Sep 28 '22 18:09

seva titov