Nodejs TFS Build Definition - node.js

Can anyone let me know how the build definition for a node.js application should look like? Also how to mention the mocha tests in the Automated tests?
First time when I tried to queue a build, I got an error saying:
Microsoft.NodejsTools.targets not found.
So I went and copied the NodejsTools folder with the .target and dll file in my build server. And I didn't see the error.
Now I get the below error:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft.WebApplication.targets (132): Could not copy the file "obj\Debug\OstNodeJs.exe" because it was not found.

You need the node.js framework and the Visual Studio node.js Tools on you build server, too. You just copied the necessarily files and this may result in other problems.
For the executable copy problem you can try to add <Disable_CopyWebApplication>True</Disable_CopyWebApplication> in the project file. See here: Build on TFS wants to copy a executable from Node.js test project

Related

Why does VS 2017 set node_modules folder to read only in .Net Core App?

I'm building a .Net Core application using Angular for my client-side code. For the most part, I'm using the default template that is included in VS 2017. For whatever reason, VS is making my node_modules folder read only. Before I was able to install packages via command line in the directory that holds my client side code as well as my package.json file and my node_modules folder. Before I was able to do this, but now it is defaulting the folder to read only which is invaliding all of my npm commands. I've verified that this is the case because I can remove the read only attribute via windows explorer and then run any of my commands like npm install.
Has anyone else encountered this before? If so, what did you do to resolve this?
Thanks!
Okay, I found the answer. VS puts a lock on the node_modules folder while it is running.
So, I guess for now if you need to add packages just close VS first.

Pre-build event grunt on build server, not finding grunt

I have been using CoffeeScript files within a project and have installed grunt into the project to compile them.
I am using Grunt Launcher to compile the files manually, but I wanted to be able to do so automatically when the project is built. To this end I put the following in the pre-build event command line under the project properties:
CD $(ProjectDir)
grunt build
This seems to work locally, but when I commit to the build server it comes back with this error:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1063,5): error MSB3073: grunt build" exited with code 9009
My research suggest that this is essentially a file not found; I presume for grunt. Some posts (here and here) suggest that added the full path is the answer, but what is the full path for grunt? Is it something like:
"path-to-project\node_modules\grunt\lib\grunt.js"
Grunt is installed both locally in the project and globally on my PC. I'm using Visual Studio 2012.
Is there anyway to get the build server to run grunt?
Thank you in advanced for any help.
Thank you to anyone who had a look at this question.
After a bit of experimenting I found putting this into the pre-build event command line works:
CD $(ProjectDir)
cmd.exe grunt build

TeamCity WindowsAzure.targets causing errors in deployment

We are currently trying to setup an Angular 2 project that also contains a Cloud Service project in its solution. We have set up numerous Angular 1 projects containing Cloud Service projects and have had no errors. When trying to run the MSBuild step for the Angular 2 project, we get the following error on the TeamCity build server:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Windows Azure Tools\2.7\Microsoft.WindowsAzure.targets(2787, 5): error MSB3021: Unable to copy file "C:\TeamCityBuildAgent\temp\buildTmp\.NETFramework,Version=v4.6.1.AssemblyAttributes.cs" to "C:\SourceControlFolder\Apps\MyApp\MyApp.CloudDeployment\obj\Debug\Website\C:\TeamCityBuildAgent\temp\buildTmp\.NETFramework,Version=v4.6.1.AssemblyAttributes.cs". The given path's format is not supported.
The main problem seems to be the build attempting to throw the full C:\TeamCityBuildAgent.. path into the obj\Debug\Website folder.
My current MSBuild parameters are:
/p:Configuration="Dev"
/p:platform="Any CPU"
/p:OctoPackEnforceAddingFiles=true
/p:OctoPackProjectName=MyApp_Dev
I've tried the following solutions:
Making sure the latest Visual Studio Update is installed (for MSBuild)
Running the install tool to repair Azure Tools 2.7 on the build server.
Changing the debug configuration in the build.
Ensuring TypeScript 1.7.6 is installed on the build server (even though it's an Azure.targets issue) [https://github.com/Microsoft/TypeScript/issues/6215]
Updated the project to Azure Tools 2.9. The same error remains except it's failing on the 2.9 folder instead now.
Curious if anyone else has experienced this error and knows a fix. I'll keep this post updated as I try other solutions.
Update
It appears that what is causing this issue is this line within the .csproj file:
<FilesToIncludeForPublish>AllFilesInProjectFolder</FilesToIncludeForPublish>
This is specified for our build configurations to copy all files generated by the ng build to the output directory of the publish. What I don't understand at the moment is how this works on all of the devs' local machines but does not work on our build server. Will keep this posted as I find more info or any kind of workaround.
This ended up being the fix:
Instead of targeting the .sln in MSBuild, we specifically targeted the .csproj file. This fixed the build errors and allowed us to keep the FilesToIncludeForPublish tag inside.

Adding cache worker role causes build error

I have an Azure cloud service project to which I am adding a cache worker role. While local build goes through fine, I get the following error on my server builds :
CloudServices38 : The entrypoint dll is not defined for worker role <cachename>
What is wrong? How do I fix this?
Make sure all the Azure DLLs are marked Copy Local = True in the properties window. Also, package your projects, then unzip them. Once you build the package, you will have a file YourProject.cspkg. Change the extension from .cspkg to .zip and extract the files. In these files you should see a file with the extension .cssx YourProject_.cssx. Change the extension from .cssx to .zip and extract again. You project that is deployed will be in the folder YourProject\sitesroot\0 - verufy all the files you are expecting (i.e. content and everything that is in the bin directory on your local build.
You need to run a Build and a Publish separately. I ran into the same problem on my project and this fixed it.
1) Visual Studio Build (or MSBuild) action with arguments /t:Build (clean here)
2) Visual Studio Build (or MSBuild) action with arguments /t:Publish (do not clean here)
Note: I had to run these actions separately (not /Build;Publish) otherwise I got an error about the cloud service entry point.
Pieced this together from this question and from here and here.

Unable to execute dex: Multiple dex files define Lcom/actionbarsherlock/R$attr;

i use ActionBarLibrary in a library, that I use in a my app
i got this message when i try to compil
[2013-01-28 16:09:46 - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/actionbarsherlock/R$attr;
[2013-01-28 16:09:46 - comfree] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/actionbarsherlock/R$attr;
As asked here, I was facing the exact same error yesterday. I pinpointed the cause of the error to /bin/classes. If I deleted the /classes dir before running the app, the app would compile and run. Of course, when I tried to actually export the app, the /classes dir would come back and along with it the error.
The solution to my problem was to install the latest version of Eclipse. You will then need to install the latest version of the ADT but all the Android versions you have downloaded earlier for the other Eclipse installation will be detected and used for this one as well. When I export or run the app through Eclipse, the /classes folder does not appear now.
right click on project to go project property>>java Build path>>choose Order and Export and then Unselect all except android4.0 or what every you have then clean and build your project ,now error not come again..
The solution to my problem was that I deleted the jar files which I copy pasted in project's lib folder. I explicitly imported external jars in build path

Resources