How to build and run a dotnet core project with a .bat file? - batch-file

I am trying to figure out how to do so for a batch file that can be ran on startup of my PC.

You can use dotnet-build and dotnet-run commands.
dotnet-build: builds a project and all of its dependencies.
dotnet-run: provides a convenient option to run your application from the source code with one command.
For more information, refer these links-
dotnet-build and
dotnet-run.

Related

Findbug windows batch commands using maven in Jenkins

I am trying to find bugs in a java file. I have added findbug plugin that is integrated with maven in Jenkins. I have used the following commands:
mvn compile
mvn findbugs:findbugs
I have a confusion on where to locate a file in the above command(.ear or .java file etc) for finding bugs.

Tosca and Jenkins

Does anybody work with Tosca and Jenkins?
I have problems to run my batch script from Jenkins. It does not open browser, but job is finished successfully. Batch script runs normally when I try to run in on Windows, without Jenkins.
Anybody has an experience using these two tools together?
In order to use Tosca CI with Jenkins you need to:
Configure your Jenkins build project
Add an additional build step (Execute Windows batch command)
Call ToscaCIClient.exe/ToscaCIClient.jar with parameters
e.g. "PathToTosca\ToscaCI\Client\ToscaCIClient.exe" -t junit -r PathToResults\result.xml
Further information can be found here: https://support.tricentis.com/community/article.do?number=KB0012411
The issue your facing is because your running Jenkins as windows service, in this case headless execution happens technically your script is executed for other user account.
Solution
Instead of installing Jenkins host it on Apache Tomcat server
Download Jenkins war file
Copy it inside webapps folder of Tomcat
Run startup.bat
Refer-
https://www.tutorialspoint.com/jenkins/jenkins_tomcat_setup.htm
I had faced the same issue.
I am guessing your slave machine running the test has jenkins services installed as services.
Uninstall the service. (.jenkins/jenkins-slave.exe uninstall)
Use the .jnlp or slave.jar to connect the machine as a slave.
Your test should run fine after that.
If it does just create a batch file to connect the machine as slave whenever it is logged in.
I tried that. But in any case, Jenkins does not open the browser, so Tests from Execution List and I do not know why.
We use Tosca 10.

Jenkins/Windows - Launch TestNG suite from .bat

Stackoverflow helped me a lot to reach that point but now I'm completely stuck, here is my problem :
I'm currently developing several tests to check a website. I code with Java in Eclipse, using testNG plugin with ReportNG for report, all of this using Windows 7 pro.
My tests work, and my report is well generated, so now I have to put it on Jenkins for my company so they will run my tests every X hours.
In order to launch my tests, I have made a file, named Run.bat, which runs the Java code, I tested it and it works, here is the code :
Run.bat
set classpath=blex_test_v1\bin;blex_test_v1\lib\*
java org.testng.TestNG blex_test_v1\blex_test_v1.xml
I now try to launch the tests on Jenkins, creating a new job and configuring it with the build section :
Run.bat
And this is my problem, I've tried everything (relative path, only the name of the file etc...) I always get this error :
java.io.IOException: Cannot run program "cmd" (in directory "/var/jenkins_home/jobs/blex_functional_test/workspace"): error=2, No such file or directory
So I checked the Jenkins workspace but my Run.bat is in it :
Workspace
I have read that Jenkins is in Linux so it might cause problem with bat files, so I tried to create a script but I didn't succeed either ..
So my question is : How can I run my test on Jenkins using my file Run.bat ? What am I doing wrong here ?
Thanks a lot !
Finally I can add an answer :
Jenkins is installed on a Unix machine so you can't run a bat file, it has to be a bash script.
To create a bash script, refer here.
Then you have to make sure that the plugin Xvfb is installed (and works) on the computer where Jenkins is installed.
I use testNG with reportNg and it doesn't work with the last firefox version so you I use firefox v34.0.5 and this version must be installed also on the Jenkins computer.
If you want to open the report after the execution, install another plugin and configure it (report HTML or something like that)
God it took me about a week but it's good to see it working !

Can the IAR command line tool "iarbuild" do a build all?

From the IAR command line, it's easy to build a particular configuration, and obviously, if I want to mimic the "build all" behavior I just run my own batch file with the configs I want.
How do I handle the case where I want to build all configs, but I don't know in advance what configurations are available?
Using Jenkins, for instance, if a developer adds a configuration in the IAR IDE, it won't be included in a build until the Jenkins scripts are manually updated. I just want Jenkins to build all the configurations without caring what they are called. In the IAR GUI for setting up batches, there is an option to rebuild all so there must be something somewhere. Thanks!
You can specify * as configuration name to build everything, like this:
c:\> iarbuild myproject.ewp -build *
One solution I've implemented years ago for this problem was to read the configuration names from the .ewp file and use them for the build.
Regards
Yves

aspnet_compiler ASPParse Could Not Load Type

I am unable to build my Web Application (not Web Site) in our build environement. We use DMAKE in our build environment (this unfortunately is non negotiable, therefore using MSBUILD is not permitted ) and when invoking the asp.net precompiler through
C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler -d -nologo -p Site -f -fixednames -errorstack -v / Debug
We get the following error
error ASPPARSE: Could not load type 'X.Y.Admin.Site.Global
If I compile from the ide it is successful. If i then compile with aspnet_compilier it is successful. So i only get a successful compile with aspnet_compiler when the target dll i am trying to compile is in the bin of the web application i am compiling.
I keep running into postings that talk about solutions using MSBUILD which unfortunately I cant try.
Any help would be appreciated
We had the same problem on our web application:
error ASPPARSE: Could not load type '...'
The problem was that we had the file on disk (on the project folder) but it wasn't included in our application project (in the .csproj file). We solved the problem by including the file in the project :)
I ran into a similar problem using NANT. The trick was to compile the web applications code files into a dll then include that when using aspnet_compiler.
use the command line compiler,either csc.exe (c#) or vbc.exe (visual basic), to compile your web application with an output of type library. This will create a dll that you can use in your aspnet_compiler task
Have you tried specifying the path using -p? Sounds to me like it can't find that type / assembly.
http://msdn.microsoft.com/en-us/library/ms229863(VS.80).aspx
For web applications, you have to build the .vb files into a dll and put that in the bin folder before you run the aspnet compiler. Check the output window in visual studio and you'll see the command line for the VB compiler. Run that first before you run the aspnet compiler, and the asp pages should be able to find the missing types.
This problem was resolved for me by simply deleting all bin and obj folders. Seems like they were in a bad state somehow. I also deleted the the .sou file, but I don't think that was the issue.
I received the same problem.
I fixed it by copying my webapp's DLL from the OBJ/DEBUG folder to the BIN folder.
I just had this error and found 2 ways to fix it, either:
Change the Codebehind attribute in the global.asax file to CodeFile and add "partial" to the class declaration
In the deployment project's property pages, set "Version output assemblies" and provide a version number
I don't really know why either worked, but it did.
solution :
-p Site path must have the directory path of .csproj file location.
ex :-
aspnet_compiler -p D:\Projects\MGM\mgm\mgm -v / D:\Projects\MGM-deploy\mgm_compiled

Resources