Search code examples
visual-studiomsbuildvisual-studio-2017visual-studio-2017-build-tools

Visual Studio 2017 MSBuild issue


I am trying to publish a Visual stuido Project from another Project, to do this I have created a bat file which runs my MSBuild file. If you run this outside of Visual Studio it works correctly but when i tried to add it to Visual Studio's prebuild scripts it does not publish. I am getting this warning -

 C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5): warning MSB3247: Found confl
icts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select
it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the a
pplication configuration file 

My MSBuild file:

<Target Name="BeforeBuild">
<MSBuild
        Projects="E:\Development\alyz\myAPI\View.API.sln"
        Targets="View_API_Search"
        Properties="DeployOnBuild=true;Configuration=Release;PublishProfile=InstallerPublish;WebPublishMethod=FileSystem;PublishURL=E:\Temp\installertemp\SearchAPI" /> 
</Target>

Visual Studio is saying that my project has built correctly but i can't work out why it's not publishing, any ideas?


Solution

  • Visual Studio is saying that my project has built correctly but i can't work out why it's not publishing, any ideas?

    You can use another solution for this issue. Following is my publish target, you can check it:

      <Target Name="BeforeBuild">
        <Exec Command="&quot;<YourMSBuild.exePath>\msbuild.exe&quot; &quot;<YourSolutionPath>\View.API.sln&quot; /p:DeployOnBuild=true /p:PublishProfile=InstallerPublish.pubxml /p:Configuration=Release /p:PublishURL=E:\Temp\installertemp\SearchAPI"></Exec>
      </Target>
    

    With this target, the project/solution will be build and published when you build the project.

    Hope this helps.