.net – publishing web app with msbuild yields different output than doing it through visual studio


I am trying to make an installer for a web app that is using blazor. I have made a setup.build file which has different targets, but I want to focus on the target that is supposed to publish my web app. I have noticed that I get a different output when I publish it through visual studio, than through the msbuild script.

Here is the snippet for the publish target:

 <Target Name="PublishWebsite">
   <!-- Remove complete publish folder in order to 
            be sure that everything will be newly compiled -->
   <Message Text="Removing publish directory: $(SetupF)"/>
   <RemoveDir Directories="$(SetupF)" ContinueOnError="false" />
   <Message Text="Start to publish website" Importance="high" />
   <MSBuild
       Projects="..\MyWebApp.csproj"
       Targets="ResolveReferences;_CopyWebApplication"
       Properties="OutDir=$(Publish)bin\;WebProjectOutputDir=
                       $(Publish);Configuration=Release" />
 </Target>

Before this target i rebuild the whole solution this project is in.

To be more specific regarding the difference in publishes:

dlls are copied into a bin directory when using setup.build but not when published through visual studio, also there are no executables when using the script while there are when using visual studio.
Is the target or the properties wrong in my build script or is it something else?

I would greatly appreciate any help!

Leave a Reply

Your email address will not be published. Required fields are marked *