Publishing a .csproj through TFS visual studio build task












0















For the software at work we have multiple projects in a solution. Most of the project we can just build the solution and then publish artifacts of the web project that we need. API and Auth projects are slightly different though. Our currently deployment process is manual and for the API (STARS.API.csproj) and Auth (STARS.Auth.csproj) project when would go into Visual Studio 2017 and right click the project and click publish, select a profile and then publish. Once that is done we take the Publish Output and drop those files on our server.



We are trying to move to a automated process through TFS and I am using the Visual Studio Build task in a build definition. However when I try to run this through TFS, an error saying that the publish profile cannot be found:




Validating PublishProfile(TFSProfile.pubxml) settings. C:Program
Files (x86)Microsoft Visual
Studio2017ProfessionalMSBuildMicrosoftVisualStudiov15.0WebMicrosoft.Web.Publishing.targets(4368,5):
Error : The value for PublishProfile is set to 'TFSProfile.pubxml',
expected to find the file at
'C:agent_work4sSTARSSource-devSTARS.WebPropertiesPublishProfilesTFSProfile.pubxml'
but it could not be found.




It is looking for publish profile in a different project folder.



Visual Studio Build Task:



enter image description here



I feel that I can approaching this completely wrong. I am just trying to replicate the process on publishing the project through Visual Studio 2017 manually.



Please let me know if you require more information.










share|improve this question



























    0















    For the software at work we have multiple projects in a solution. Most of the project we can just build the solution and then publish artifacts of the web project that we need. API and Auth projects are slightly different though. Our currently deployment process is manual and for the API (STARS.API.csproj) and Auth (STARS.Auth.csproj) project when would go into Visual Studio 2017 and right click the project and click publish, select a profile and then publish. Once that is done we take the Publish Output and drop those files on our server.



    We are trying to move to a automated process through TFS and I am using the Visual Studio Build task in a build definition. However when I try to run this through TFS, an error saying that the publish profile cannot be found:




    Validating PublishProfile(TFSProfile.pubxml) settings. C:Program
    Files (x86)Microsoft Visual
    Studio2017ProfessionalMSBuildMicrosoftVisualStudiov15.0WebMicrosoft.Web.Publishing.targets(4368,5):
    Error : The value for PublishProfile is set to 'TFSProfile.pubxml',
    expected to find the file at
    'C:agent_work4sSTARSSource-devSTARS.WebPropertiesPublishProfilesTFSProfile.pubxml'
    but it could not be found.




    It is looking for publish profile in a different project folder.



    Visual Studio Build Task:



    enter image description here



    I feel that I can approaching this completely wrong. I am just trying to replicate the process on publishing the project through Visual Studio 2017 manually.



    Please let me know if you require more information.










    share|improve this question

























      0












      0








      0








      For the software at work we have multiple projects in a solution. Most of the project we can just build the solution and then publish artifacts of the web project that we need. API and Auth projects are slightly different though. Our currently deployment process is manual and for the API (STARS.API.csproj) and Auth (STARS.Auth.csproj) project when would go into Visual Studio 2017 and right click the project and click publish, select a profile and then publish. Once that is done we take the Publish Output and drop those files on our server.



      We are trying to move to a automated process through TFS and I am using the Visual Studio Build task in a build definition. However when I try to run this through TFS, an error saying that the publish profile cannot be found:




      Validating PublishProfile(TFSProfile.pubxml) settings. C:Program
      Files (x86)Microsoft Visual
      Studio2017ProfessionalMSBuildMicrosoftVisualStudiov15.0WebMicrosoft.Web.Publishing.targets(4368,5):
      Error : The value for PublishProfile is set to 'TFSProfile.pubxml',
      expected to find the file at
      'C:agent_work4sSTARSSource-devSTARS.WebPropertiesPublishProfilesTFSProfile.pubxml'
      but it could not be found.




      It is looking for publish profile in a different project folder.



      Visual Studio Build Task:



      enter image description here



      I feel that I can approaching this completely wrong. I am just trying to replicate the process on publishing the project through Visual Studio 2017 manually.



      Please let me know if you require more information.










      share|improve this question














      For the software at work we have multiple projects in a solution. Most of the project we can just build the solution and then publish artifacts of the web project that we need. API and Auth projects are slightly different though. Our currently deployment process is manual and for the API (STARS.API.csproj) and Auth (STARS.Auth.csproj) project when would go into Visual Studio 2017 and right click the project and click publish, select a profile and then publish. Once that is done we take the Publish Output and drop those files on our server.



      We are trying to move to a automated process through TFS and I am using the Visual Studio Build task in a build definition. However when I try to run this through TFS, an error saying that the publish profile cannot be found:




      Validating PublishProfile(TFSProfile.pubxml) settings. C:Program
      Files (x86)Microsoft Visual
      Studio2017ProfessionalMSBuildMicrosoftVisualStudiov15.0WebMicrosoft.Web.Publishing.targets(4368,5):
      Error : The value for PublishProfile is set to 'TFSProfile.pubxml',
      expected to find the file at
      'C:agent_work4sSTARSSource-devSTARS.WebPropertiesPublishProfilesTFSProfile.pubxml'
      but it could not be found.




      It is looking for publish profile in a different project folder.



      Visual Studio Build Task:



      enter image description here



      I feel that I can approaching this completely wrong. I am just trying to replicate the process on publishing the project through Visual Studio 2017 manually.



      Please let me know if you require more information.







      c# visual-studio tfs visual-studio-2017






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 21 '18 at 12:52









      RossRoss

      497221




      497221
























          1 Answer
          1






          active

          oldest

          votes


















          1














          I suggest you start using the pre-defined build variables. $(Build.SourcesDirectory) will map to C:agent_work4s, and from there you can create a full path to the TFSProfile.pubxml, where ever it might be in your source tree. Use this full path in the MB Build Arguments, PublishProfile property, e.g.



          /p:PublishProfile=$(Build.SourcesDirectory)STARSSource-devSTARS-APITFSProfile.pubxml


          Another problem you may have is that in the Solution field you are not specifying a solution (.sln) but a project (.csproj). I suspect that MSBuild is picking up the solution associated with that csproj, and building the whole solution, which is why it is looking for a publish profile in STARS.Web. Have you created a publish profile for STARS.API?






          share|improve this answer


























          • I am using the same PublishProfile that we use when manually publishing STARS.API.csproj and it work correctly that way.

            – Ross
            Nov 21 '18 at 13:42











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53412463%2fpublishing-a-csproj-through-tfs-visual-studio-build-task%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          I suggest you start using the pre-defined build variables. $(Build.SourcesDirectory) will map to C:agent_work4s, and from there you can create a full path to the TFSProfile.pubxml, where ever it might be in your source tree. Use this full path in the MB Build Arguments, PublishProfile property, e.g.



          /p:PublishProfile=$(Build.SourcesDirectory)STARSSource-devSTARS-APITFSProfile.pubxml


          Another problem you may have is that in the Solution field you are not specifying a solution (.sln) but a project (.csproj). I suspect that MSBuild is picking up the solution associated with that csproj, and building the whole solution, which is why it is looking for a publish profile in STARS.Web. Have you created a publish profile for STARS.API?






          share|improve this answer


























          • I am using the same PublishProfile that we use when manually publishing STARS.API.csproj and it work correctly that way.

            – Ross
            Nov 21 '18 at 13:42
















          1














          I suggest you start using the pre-defined build variables. $(Build.SourcesDirectory) will map to C:agent_work4s, and from there you can create a full path to the TFSProfile.pubxml, where ever it might be in your source tree. Use this full path in the MB Build Arguments, PublishProfile property, e.g.



          /p:PublishProfile=$(Build.SourcesDirectory)STARSSource-devSTARS-APITFSProfile.pubxml


          Another problem you may have is that in the Solution field you are not specifying a solution (.sln) but a project (.csproj). I suspect that MSBuild is picking up the solution associated with that csproj, and building the whole solution, which is why it is looking for a publish profile in STARS.Web. Have you created a publish profile for STARS.API?






          share|improve this answer


























          • I am using the same PublishProfile that we use when manually publishing STARS.API.csproj and it work correctly that way.

            – Ross
            Nov 21 '18 at 13:42














          1












          1








          1







          I suggest you start using the pre-defined build variables. $(Build.SourcesDirectory) will map to C:agent_work4s, and from there you can create a full path to the TFSProfile.pubxml, where ever it might be in your source tree. Use this full path in the MB Build Arguments, PublishProfile property, e.g.



          /p:PublishProfile=$(Build.SourcesDirectory)STARSSource-devSTARS-APITFSProfile.pubxml


          Another problem you may have is that in the Solution field you are not specifying a solution (.sln) but a project (.csproj). I suspect that MSBuild is picking up the solution associated with that csproj, and building the whole solution, which is why it is looking for a publish profile in STARS.Web. Have you created a publish profile for STARS.API?






          share|improve this answer















          I suggest you start using the pre-defined build variables. $(Build.SourcesDirectory) will map to C:agent_work4s, and from there you can create a full path to the TFSProfile.pubxml, where ever it might be in your source tree. Use this full path in the MB Build Arguments, PublishProfile property, e.g.



          /p:PublishProfile=$(Build.SourcesDirectory)STARSSource-devSTARS-APITFSProfile.pubxml


          Another problem you may have is that in the Solution field you are not specifying a solution (.sln) but a project (.csproj). I suspect that MSBuild is picking up the solution associated with that csproj, and building the whole solution, which is why it is looking for a publish profile in STARS.Web. Have you created a publish profile for STARS.API?







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 21 '18 at 13:32

























          answered Nov 21 '18 at 13:19









          PolyfunPolyfun

          7,67242736




          7,67242736













          • I am using the same PublishProfile that we use when manually publishing STARS.API.csproj and it work correctly that way.

            – Ross
            Nov 21 '18 at 13:42



















          • I am using the same PublishProfile that we use when manually publishing STARS.API.csproj and it work correctly that way.

            – Ross
            Nov 21 '18 at 13:42

















          I am using the same PublishProfile that we use when manually publishing STARS.API.csproj and it work correctly that way.

          – Ross
          Nov 21 '18 at 13:42





          I am using the same PublishProfile that we use when manually publishing STARS.API.csproj and it work correctly that way.

          – Ross
          Nov 21 '18 at 13:42




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53412463%2fpublishing-a-csproj-through-tfs-visual-studio-build-task%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          Xamarin.form Move up view when keyboard appear

          Post-Redirect-Get with Spring WebFlux and Thymeleaf

          Anylogic : not able to use stopDelay()