# Free style Jenkins build issue for net core application

**URL:** <https://community.jenkins.io/t/free-style-jenkins-build-issue-for-net-core-application/493>\
**Category:** Ask a question\
**Created:** [October 7, 2021, 7:10pm UTC](https://community.jenkins.io/t/free-style-jenkins-build-issue-for-net-core-application/493 "2021-10-07T19:10:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kal](https://avatars.discourse-cdn.com/v4/letter/k/9de053/32.png) [@Kal](https://community.jenkins.io/u/Kal)\
**Post date:** [October 7, 2021, 7:10pm UTC](https://community.jenkins.io/t/free-style-jenkins-build-issue-for-net-core-application/493/1 "2021-10-07T19:10:33Z")

</div>

Using below command  
MSBUILD. Exe /target:restore /target:build %workspace©

Only restore alone happening  
Target build not executing  
But build success

I need restore and build in same command

---

<div class="post-metadata">

**Author:** ![halkeye](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/halkeye/32/8_2.png) [@halkeye](https://community.jenkins.io/u/halkeye)\
**Post date:** [October 7, 2021, 7:42pm UTC](https://community.jenkins.io/t/free-style-jenkins-build-issue-for-net-core-application/493/2 "2021-10-07T19:42:57Z")

</div>

are you using a shell command, or some sort of msbuild plugin? if its a shell step you should have full control over what you run. If its a msbuild plugin, sadly thats the issue with freestyle and those plugins, the lack of fine grain control, you’ll have to wait for people with more experience using it.

---

<div class="post-metadata">

**Author:** ![MarkEWaite](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/markewaite/32/20_2.png) [@MarkEWaite](https://community.jenkins.io/u/MarkEWaite)\
**Post date:** [October 9, 2021, 2:32pm UTC](https://community.jenkins.io/t/free-style-jenkins-build-issue-for-net-core-application/493/3 "2021-10-09T14:32:13Z")

</div>

Based on [MSBuild Command-Line Reference - MSBuild | Microsoft Docs](https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-command-line-reference?view=vs-2019) I assume that the `-target` argument (or `/target`) is only allowed once in a command line. The last one “wins”.

The docs says that you can run multiple targets with `-target:first;second;third` . Pass a semicolon separated list to the `-target` argument.

---

<div class="post-metadata">

**Author:** ![Kal](https://avatars.discourse-cdn.com/v4/letter/k/9de053/32.png) [@Kal](https://community.jenkins.io/u/Kal)\
**Post date:** [October 9, 2021, 3:46pm UTC](https://community.jenkins.io/t/free-style-jenkins-build-issue-for-net-core-application/493/4 "2021-10-09T15:46:18Z")

</div>

Hi,

I have tried the below command

MsBuild. exe /target:“restore;Build” %workspace%\doc\doc.sln /p:OutDir= %workspace%\doc\webdeploy\Release /P:skipInvaildconfiguration=true /p:Deployonbuild=true /p:deploytype=package /P:Generatesampledeployscript=true /P:DeployIISpath= doc

The below arguments not executed.

p:Deployonbuild=true /p:deploytype=package /P:Generatesampledeployscript=true

---

<div class="post-metadata">

**Author:** ![MarkEWaite](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/markewaite/32/20_2.png) [@MarkEWaite](https://community.jenkins.io/u/MarkEWaite)\
**Post date:** [October 9, 2021, 4:11pm UTC](https://community.jenkins.io/t/free-style-jenkins-build-issue-for-net-core-application/493/5 "2021-10-09T16:11:08Z")

</div>

Does that command work from a Windows command prompt?

If not, then you may need to consult with people who understand the details of msbuild.exe interaction with the windows command prompt.

If it does work from the command prompt but fails in Jenkins, then you may need to check that `workspace` has a sensible value in your Jenkins job

---

<div class="post-metadata">

**Author:** ![halkeye](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/halkeye/32/8_2.png) [@halkeye](https://community.jenkins.io/u/halkeye)\
**Post date:** [October 9, 2021, 5:44pm UTC](https://community.jenkins.io/t/free-style-jenkins-build-issue-for-net-core-application/493/6 "2021-10-09T17:44:08Z")

</div>

i’m a little concerned by the space between = and the value. On linux = means your providing the value as the same argument, without the = you do it as the next argument.

---

<div class="post-metadata">

**Author:** ![Kal](https://avatars.discourse-cdn.com/v4/letter/k/9de053/32.png) [@Kal](https://community.jenkins.io/u/Kal)\
**Post date:** [October 10, 2021, 2:35pm UTC](https://community.jenkins.io/t/free-style-jenkins-build-issue-for-net-core-application/493/7 "2021-10-10T14:35:29Z")

</div>

Hi,

I have checked and tried  
Still facing the same error
