3

Is there any variable or property which i could use in msbuild command to get all project references from .csproj?

NSwag.exe webapi2swagger /assembly:@(GimmeAllReferencies?) /controller:Namespace.MyController /output:SwaggerFiles/MyControllerSwagger.json

EDIT: Sorry for my imprecisions. I have project A which has project references to project B, C, D. What I need to know is where are dlls to this project to use them in my afterbuild task. Here is what i've got for now:

<Target Name="AfterBuild">
   <MSBuild Projects="@(ProjectReference)" Targets="Build" BuildInParallel="true">
     <Output TaskParameter="TargetOutputs" ItemName="OutputAssemblies" />
   </MSBuild>
   <Exec Command="$(SolutionDir)Packages\NSwag.4.0.0\NSwag.exe webapi2swagger /assembly:@(OutputAssemblies,','),$(TargetPath) /controller:Controller1 /output:Swagger1.json" />
   <Exec Command="$(SolutionDir)Packages\NSwag.4.0.0\NSwag.exe webapi2swagger /assembly:@(OutputAssemblies,','),$(TargetPath) /controller:Controller2 /output:Swagger2.json" />
  <Exec Command="$(SolutionDir)Packages\NSwag.4.0.0\NSwag.exe webapi2swagger /assembly:@(OutputAssemblies,','),$(TargetPath) /controller:Conotrller3 /output:Swagger3.json" />
</Target>

(@(ProjectReference) gather all project references (B,C,D) in project A.)

($(TargetPath) is path to the dll with project A)

My question is: Is this solution will build these dll again or it'll skip build process because they were already build?

Bruno Bieri
  • 9,724
  • 11
  • 63
  • 92
shrubbery
  • 31
  • 3
  • You should also add the msbuild command (eg exec) and state what dlls should be included... – Rico Suter Aug 06 '16 at 08:38
  • If you mean you want to get the content of the `Reference` ItemGroup displayed, then it's as simple as adding a target which does `` – stijn Aug 06 '16 at 10:29

2 Answers2

0

According to this question i used Targets="GetTargetPath" in my code.

How i can actually check if this build action is not performing again?

Community
  • 1
  • 1
shrubbery
  • 31
  • 3
0

With the current release, you can define wildcards in the assembly paths like:

../**/bin/$(Configuration)/*.dll
Rico Suter
  • 11,548
  • 6
  • 67
  • 93