visual studio 2010 - Error initializing task DownloadNuGet: Not registered task DownloadNuGet -


i attempting compile c# application using mono on ubuntu. trying prevent need include nuget.exe in git repository , have followed accepted answer in this question

this works if using visual studio 2010. when build application, nuget.exe downloaded expected.

however, when attempt use mono , xbuild, receive following error.

target build:     project "/home/builduser/specialbuildproj/buildtrade/buildtrade.csproj" (default target(s)):     target checkprerequisites:         project "/home/builduser/specialbuildproj/.nuget/nuget.targets" (_downloadnuget target(s)):             target _downloadnuget: : error : error initializing task downloadnuget: not registered task downloadnuget.             task "downloadnuget" execution -- failed             done building target "_downloadnuget" in project "/home/builduser/specialbuildproj/.nuget/nuget.targets".-- failed         done building project "/home/builduser/specialbuildproj/.nuget/nuget.targets".-- failed     task "msbuild" execution -- failed     done building target "checkprerequisites" in project "/home/builduser/specialbuildproj/buildtrade/buildtrade.csproj".-- failed     done building project "/home/builduser/specialbuildproj/buildtrade/buildtrade.csproj".-- failed task "msbuild" execution -- failed done building target "build" in project "/home/builduser/specialbuildproj/specialbuildproj.sln".-- failed done building project "/home/builduser/specialbuildproj/specialbuildproj.sln".-- failed 

the thing i've changed setting downloadnugetexe = true in nuget.targets, line looks this:

<downloadnugetexe condition=" '$(downloadnugetexe)' == '' ">true</downloadnugetexe> 

my question: how can set behavior using mono/xbuild same when using visual studio (namely, nuget downloaded automatically)?

edit usingtask line appears in nuget.targets file.

<usingtask taskname="downloadnuget" taskfactory="codetaskfactory" assemblyfile="$(msbuildtoolspath)\microsoft.build.tasks.v4.0.dll">     <parametergroup>         <outputfilename parametertype="system.string" required="true" />     </parametergroup>     <task>         <reference include="system.core" />         <using namespace="system" />         <using namespace="system.io" />         <using namespace="system.net" />         <using namespace="microsoft.build.framework" />         <using namespace="microsoft.build.utilities" />         <code type="fragment" language="cs">             <![cdata[             try {                 outputfilename = path.getfullpath(outputfilename);                  log.logmessage("downloading latest version of nuget.exe...");                 webclient webclient = new webclient();                 webclient.downloadfile("https://nuget.org/nuget.exe", outputfilename);                  return true;             }             catch (exception ex) {                 log.logerrorfromexception(ex);                 return false;             }         ]]>         </code>     </task> </usingtask> 

create script download it. e.g.

wget http://nuget.org/nuget.exe cp nuget.exe ./.nuget/nuget.exe chmod a+x ./.nuget/nuget.exe 

this keeps nuget.exe date. source


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -