.Net Core 2 not building my SPA because it can't Exec properly? - build

I have created an React+Redux using the .Net Core 2.0 template. I didn't change anything yet it's not buildind.
Severity Code Description Project File Line Suppression State
Warning MSB3073 The command "node --version" exited with code
1. WebApplication2 C:\Tests\WebApplication2\WebApplication2\WebApplication2.csproj 25
Yet, node is properly installed, when I run "node --version" in a prompt (from any drive/directory) I get v8.4.0 and no error code (the expected behaviour).
I tried using the full path in the .csproj file.
<Exec Command=""C:\Program Files\nodejs\node" --version" ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
And I'm still getting the same error
Severity Code Description Project File Line Suppression State
Warning MSB3073 The command ""C:\Program Files\nodejs\node" --version"
exited with code
1. WebApplication2 C:\Tests\WebApplication2\WebApplication2\WebApplication2.csproj 25
I reinstalled NodeJS, with the same results.
Then I even tried a dummy task calling dos echo 0 and it still fails.
Severity Code Description Project File Line Suppression State
Warning MSB3073 The command "echo 0" exited with code
1. WebApplication2 C:\Tests\WebApplication2\WebApplication2\WebApplication2.csproj 25
What's going on?
Here's the whole segment which does the check:
<Target Name="DebugRunWebpack" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('wwwroot\dist') ">
<!-- Ensure Node.js is installed -->
<Exec Command=""C:\Program Files\nodejs\node" --version" ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Error Condition="'$(ErrorCode)' != '0'" Text="Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE." />
<!-- In development, the dist files won't exist on the first run or when cloning to
a different machine, so rebuild them if not already present. -->
<Message Importance="high" Text="Performing first-run Webpack build..." />
<Exec Command="node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js" />
<Exec Command="node node_modules/webpack/bin/webpack.js" />
</Target>

This had been related to security issue of some sort.
Running "dotnet run" from a command prompt run with admin rights "fixed" the issue.

I ran into this issue (I realized that my node_modules folder wasn't there) so I upgraded my .Net Core app to 2.1 and ran npm i and that worked.
Doesn't hurt to just try npm i and try again

Related

Unable to execute sample axis2Client WSO2 EI 6.6.0

I am trying to use sample Axis2Client but I am facing an issue as below. I am following the page https://docs.wso2.com/display/EI6xx/Using+the+ESB+as+JMS+Consumer+and+Producer.
ant stockquote -Dmode=placeorder -Dtrpurl="jms:/StockQuoteProxy?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616&transport.jms.ContentTypeProperty=Content-Type&transport.jms.DestinationType=queue"
Buildfile: /Users/user/WUM/wso2ei-6.6.0/samples/axis2Client/build.xml
init:
BUILD FAILED
/Users/user/WUM/wso2ei-6.6.0/samples/axis2Client/build.xml:307: /Users/user/WUM/wso2ei-6.6.0/wso2/lib/endorsed does not exist.
Total time: 0 seconds
How to fix this issue?
Could you please remove the following from the build.xml located in wso2ei-6.6.0/samples/axis2Client. Then try executing the same command again
<fileset dir="../../wso2/lib/endorsed">
<include name="*.jar"/>
</fileset>

nuget restore failing in team services build

I have 2 local assemblies referenced via nuget (packed the dll's up) using vs2017 on a asp.net core solution, builds fine locally.
Now trying to generate a build via VSTS i am getting the following error,
Detected NuGet version 4.0.0.2283 / 4.0.0
SYSTEMVSSCONNECTION exists true
Saving NuGet.config to a temporary config file.
d:\a\_tool\NuGet\4.0.0\x64\nuget.exe restore d:\a\1\s\TestFrameworkCoreAPI.sln -Verbosity Detailed -NonInteractive -ConfigFile d:\a\1\Nuget\tempNuGet_37.config
NuGet Version: 4.0.0.2283
MSBuild auto-detection: using msbuild version '15.3.409.57025' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
MSBuild P2P timeout [ms]: 120000
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin\msbuild.exe /t:GenerateRestoreGraphFile /nologo /nr:false /p:RestoreUseCustomAfterTargets=true /p:BuildProjectReferences=false /v:q /p:NuGetRestoreTargets="d:\a\_temp\NuGet-Scratch\w53qa5rr.4sd.targets" /p:RestoreTaskAssemblyFile="d:\a\_tool\NuGet\4.0.0\x64\nuget.exe" /p:RestoreGraphOutputPath="d:\a\_temp\NuGet-Scratch\4mlmlfgh.mmy.result" /p:ExcludeRestorePackageImports=true /p:RestoreRecursive=False /p:RestoreProjectFilterMode=exclusionlist /p:RestoreContinueOnError=WarnAndContinue /p:RestoreGraphProjectInput="d:\a\1\s\TestFrameworkCoreAPI\TestFrameworkCoreAPI.csproj;" "d:\a\_temp\NuGet-Scratch\w53qa5rr.4sd.targets"
Running restore with 2 concurrent jobs.
Reading project file d:\a\1\s\TestFrameworkCoreAPI\TestFrameworkCoreAPI.csproj.
Reading project file d:\a\1\s\TestFrameworkCoreAPI\TestFrameworkCoreAPI.csproj.
Restoring packages for d:\a\1\s\TestFrameworkCoreAPI\TestFrameworkCoreAPI.csproj...
Restoring packages for d:\a\1\s\TestFrameworkCoreAPI\TestFrameworkCoreAPI.csproj...
Restoring packages for .NETCoreApp,Version=v1.1...
Restoring packages for .NETCoreApp,Version=v2.0...
System.AggregateException: One or more errors occurred. ---> NuGet.Protocol.Core.Types.FatalProtocolException: Failed to retrieve information about 'Microsoft.VisualStudio.Web.CodeGeneration.Tools' from remote source 'D:\TestFrameworkAssemblies'.
at NuGet.Protocol.LocalV3FindPackageByIdResource.GetVersionsCore(String id, ILogger logger)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at NuGet.Protocol.LocalV3FindPackageByIdResource.GetAllVersionsAsync(String id, SourceCacheContext cacheContext, ILogger logger, CancellationToken token)
at NuGet.Commands.SourceRepositoryDependencyProvider.<FindLibraryAsync>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
Error: d:\a\_tool\NuGet\4.0.0\x64\nuget.exe failed with return code: 1
Packages failed to restore
I have a nuget.config file in a .nuget folder located in the root of solution,
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!-- remove any machine-wide sources with <clear/> -->
<clear />
<add key="Test Framework" value="D:\TestFrameworkAssemblies" />
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
</packageSources>
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
</configuration>
This is what is in the VSTS build def, NuGet restore step
It looks like it always references my local assembly and not the standard nuget.org, now in the config file, if i take out my local entry to framework assemblies, the nuget part works but i get a primary reference error as it cannot find the 2 assemblies i have packed locally.
Been going round in circles with this at the moment, how can you get VSTS to restore local packed assemblies as well as from nuget.org. I am using Hosted 2017 as well.
thanks in advance
It seems you were queue the build on Hosted agent. Since there has the packages located on your local machine, you should build with the private agent which located on your local machine.
Additional, if you need to queue the build on Hosted agent, you should add the local packages in repository, and then reference the packages with the new path and change the value in nuget.config.

gocd - making custom command script available to agent

I am trying to add a custom command which in turn calls a python script, as per example here https://support.thoughtworks.com/hc/en-us/articles/213253646-Go-s-custom-command,
<exec command="myecho.sh">
</exec>
In my case,
<exec command="/usr/bin/python cd_dashboard.py">
<arg>-v</arg>
</exec>
But when I execute the pipeline it fails with following error,
[go] Task: "/usr/bin/python cd_dashboard.py" -vtook: 0.2s
Error happened while attempting to execute '/usr/bin/python cd_dashboard.py -v'.
Please make sure [/usr/bin/python cd_dashboard.py] can be executed on this agent.
So the question is where should the python script reside to be accessible to agent? Should be in agent's PATH.
Is this correct understanding?
The command should be /usr/bin/python, please move cd_dashboard.py to the args. Right now GoCD trying to run executable /usr/bin/python cd_dashboard.py, which of course doesn't exist. You should have something like this:
<exec command="/usr/bin/python">
<arg>-v</arg>
<arg>cd_dashboard.py</arg>
</exec>

Running Python script to deploy from MSBuild

I have a python script that is doing some deployment.
I want to run that script from msbuild and get the output in case it pass, or failed.
So, how can I communicate to msbuild of the status , and the error text?
I want to show the result on the build server.
I have to use python 2.7, and cannot use 3.x
Run the command using the Exec task and capture it's output. For example:
<Target Name="GetPythonOutput">
<PropertyGroup>
<PyCommand>/path/to/python.exe -a /path/to/pthonfile</PyCommand>
<TempFile>ExecTempFile</TempFile>
</PropertyGroup>
<Exec Command="$(PyCommand) > $(TempFile)" />
<ReadLinesFromFile File="$(TempFile)">
<Output TaskParameter="Lines" ItemName="PyOutput"/>
</ReadLinesFromFile>
<Delete Files="$(TempFile)" />
<Message Text="Python command output was: #(PyOutput)" />
</Target>
If you are using .Net 4.5 things are better since Exec can do most of the work for you

nunit console is not telling what tests got failed

I recently moved out of nunit tag and moved to exec tag to run nunit console for running unit tests.
Here is what i have in my build script:
exec program="nunit-console.exe" verbose="true" failonerror="true">
arg file="../abc.dll"/>
exec>
Here is what I see in output:
task name="exec">250.0064250.0064
As you can see it did run from the duration and I know that my tests are currently failing but my build didn't fail.
Any ideas?
To be honest: I'm clueless. We're executing NUnit console through NAnt's <exec> task, we're getting meaningful output and we're absolutely not doing anything fancy:
<exec program="C:\dev\tools\NUnit\2.5.9\bin\net-2.0\nunit-console.exe">
<arg file="C:\foo\bar.dll" />
</exec>