In old .NET we used to be able to run the csc compiler to compile a single .cs file or several files.
With .NET Core we have dotnet build that insists on having a proper project file. Is there a stand-alone command line compiler that would allow to compile source code files without having a project (and listing referenced dependencies on the same command line)?
On Linux, when I have the old csc and the new .NET Core installed, I get these timings:
[root#li1742-80 test]# time dotnet build
Microsoft (R) Build Engine version 15.3.409.57025 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
test -> /root/test/bin/Debug/netcoreapp2.0/test.dll
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:03.94
real 0m7.027s
user 0m5.714s
sys 0m0.838s
[root#li1742-80 test]# time csc Program.cs
Microsoft (R) Visual C# Compiler version 2.3.0.61801 (3722bb71)
Copyright (C) Microsoft Corporation. All rights reserved.
real 0m0.613s
user 0m0.522s
sys 0m0.071s
[root#li1742-80 test]#
Note 7 seconds with .NET Core versus several hundred milliseconds with the old csc for the same file, Program.cs.
I'd like to be able to compile as fast with .NET Core as I used to be able with csc.
Yes, it is possible to compile a single file with csc or vbc compilers in .NET Core.
To invoke the Roslyn compiler directly it is necessary to use the command line driver csc.{exe|dll} and since Roslyn in contrast to the old csc.exe does not reference mscorlib.dll implicitly it is necessary to pass a reference to the required dependencies, i.e. System.Runtime and System.Private.CoreLib libraries and any other required references. The following listing shows how to compile the following Hello, World! program.
using System;
namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, World!");
}
}
}
Using WSL with Ubuntu 16.04 (Xenial Xerus) and dotnet-sdk-2.0.0 installed:
time dotnet /usr/share/dotnet/sdk/2.0.0/Roslyn/csc.exe -r:/usr/share/dotnet/shared/Microsoft.NETCore.App/2.0.0/System.Private.CoreLib.dll -r:/usr/share/dotnet/shared/Microsoft.NETCore.App/2.0.0/System.Console.dll -r:/usr/share/dotnet/shared/Microsoft.NETCore.App/2.0.0/System.Runtime.dll HelloWorld.cs
Microsoft (R) Visual C# Compiler version 2.3.2.61921 (ad0efbb6)
Copyright (C) Microsoft Corporation. All rights reserved.
real 0m0.890s
user 0m0.641s
sys 0m0.250s
ls -li
total 4
4785074604720852 -rw-rw-rw- 1 developer developer 178 Dec 7 15:07 HelloWorld.cs
11821949022487213 -rw-rw-rw- 1 developer developer 4096 Dec 7 15:13 HelloWorld.exe
The required dependencies, which are passed to the compiler, are different on different platforms, i.e. on Windows it is enough to pass System.Runtime.dll and System.Console.dll while on Ubuntu 16.04 it is necessary to pass in addition System.Private.CoreLib.dll. Different SDK versions will have Roslyn and command line drivers located in different places - the SDK layout changes between versions - and the newest 2.2.2 SDK ships with csc.dll and vbc.dll instead of csc.exe and vbc.exe. Therefore, before using this method it is necessary to check your SDK layout.
Detailed explanation
The Roslyn compiler was designed in a bit different way than the previously used csc.exe and vbc.exe compilers. First of all, Roslyn is written in C# and VB.NET and is a managed .NET application. On Windows it used mainly as a common service running in a server process VBCSCompiler.exe (.dll). However, Roslyn ships with managed command line drivers, csc.exe and vbc.exe (the latest .NET SDK versions ship with csc.dll and vbc.dll) which can be used to compile source files directly from the command line. Anyway, it is exactly what the build system in .NET does, invoking Roslyn via the command line. Running a simple dotnet csc.exe -help command will print usage information which will guide in using the compiler directly from the command line (see the last listing).
The major difference between old native compilers and Roslyn is due to the fact that the latter is a managed application is a startup time. Roslyn, even after being compiled to R2R native assemblies (Ready To Run), would need to start by loading the whole .NET framework, initializing it and then loading Roslyn assemblies and starting the compilation process. It is always a bit slower than running the native compiler, however, as can be seen from above timings, not that much slower.
There was a new documentation article added to the corefx repository describing Advanced scenario - Build and run application code with csc/vbc and CoreRun. Anyone interested can use it as a guideline how to work at the low level of .NET Core.
Microsoft (R) Visual C# Compiler version 2.3.2.61921 (ad0efbb6)
Copyright (C) Microsoft Corporation. All rights reserved.
Visual C# Compiler Options
- OUTPUT FILES -
/out:<file> Specify output file name (default: base name of
file with main class or first file)
/target:exe Build a console executable (default) (Short
form: /t:exe)
/target:winexe Build a Windows executable (Short form:
/t:winexe)
/target:library Build a library (Short form: /t:library)
/target:module Build a module that can be added to another
assembly (Short form: /t:module)
/target:appcontainerexe Build an Appcontainer executable (Short form:
/t:appcontainerexe)
/target:winmdobj Build a Windows Runtime intermediate file that
is consumed by WinMDExp (Short form: /t:winmdobj)
/doc:<file> XML Documentation file to generate
/refout:<file> Reference assembly output to generate
/platform:<string> Limit which platforms this code can run on: x86,
Itanium, x64, arm, anycpu32bitpreferred, or
anycpu. The default is anycpu.
- INPUT FILES -
/recurse:<wildcard> Include all files in the current directory and
subdirectories according to the wildcard
specifications
/reference:<alias>=<file> Reference metadata from the specified assembly
file using the given alias (Short form: /r)
/reference:<file list> Reference metadata from the specified assembly
files (Short form: /r)
/addmodule:<file list> Link the specified modules into this assembly
/link:<file list> Embed metadata from the specified interop
assembly files (Short form: /l)
/analyzer:<file list> Run the analyzers from this assembly
(Short form: /a)
/additionalfile:<file list> Additional files that don't directly affect code
generation but may be used by analyzers for producing
errors or warnings.
/embed Embed all source files in the PDB.
/embed:<file list> Embed specific files in the PDB
- RESOURCES -
/win32res:<file> Specify a Win32 resource file (.res)
/win32icon:<file> Use this icon for the output
/win32manifest:<file> Specify a Win32 manifest file (.xml)
/nowin32manifest Do not include the default Win32 manifest
/resource:<resinfo> Embed the specified resource (Short form: /res)
/linkresource:<resinfo> Link the specified resource to this assembly
(Short form: /linkres) Where the resinfo format
is <file>[,<string name>[,public|private]]
- CODE GENERATION -
/debug[+|-] Emit debugging information
/debug:{full|pdbonly|portable|embedded}
Specify debugging type ('full' is default,
'portable' is a cross-platform format,
'embedded' is a cross-platform format embedded into
the target .dll or .exe)
/optimize[+|-] Enable optimizations (Short form: /o)
/deterministic Produce a deterministic assembly
(including module version GUID and timestamp)
/refonly Produce a reference assembly in place of the main output
/instrument:TestCoverage Produce an assembly instrumented to collect
coverage information
/sourcelink:<file> Source link info to embed into PDB.
- ERRORS AND WARNINGS -
/warnaserror[+|-] Report all warnings as errors
/warnaserror[+|-]:<warn list> Report specific warnings as errors
/warn:<n> Set warning level (0-4) (Short form: /w)
/nowarn:<warn list> Disable specific warning messages
/ruleset:<file> Specify a ruleset file that disables specific
diagnostics.
/errorlog:<file> Specify a file to log all compiler and analyzer
diagnostics.
/reportanalyzer Report additional analyzer information, such as
execution time.
- LANGUAGE -
/checked[+|-] Generate overflow checks
/unsafe[+|-] Allow 'unsafe' code
/define:<symbol list> Define conditional compilation symbol(s) (Short
form: /d)
/langversion:<string> Specify language version mode: ISO-1, ISO-2, 3,
4, 5, 6, 7, 7.1, Default, or Latest
- SECURITY -
/delaysign[+|-] Delay-sign the assembly using only the public
portion of the strong name key
/publicsign[+|-] Public-sign the assembly using only the public
portion of the strong name key
/keyfile:<file> Specify a strong name key file
/keycontainer:<string> Specify a strong name key container
/highentropyva[+|-] Enable high-entropy ASLR
- MISCELLANEOUS -
#<file> Read response file for more options
/help Display this usage message (Short form: /?)
/nologo Suppress compiler copyright message
/noconfig Do not auto include CSC.RSP file
/parallel[+|-] Concurrent build.
/version Display the compiler version number and exit.
- ADVANCED -
/baseaddress:<address> Base address for the library to be built
/checksumalgorithm:<alg> Specify algorithm for calculating source file
checksum stored in PDB. Supported values are:
SHA1 (default) or SHA256.
/codepage:<n> Specify the codepage to use when opening source
files
/utf8output Output compiler messages in UTF-8 encoding
/main:<type> Specify the type that contains the entry point
(ignore all other possible entry points) (Short
form: /m)
/fullpaths Compiler generates fully qualified paths
/filealign:<n> Specify the alignment used for output file
sections
/pathmap:<K1>=<V1>,<K2>=<V2>,...
Specify a mapping for source path names output by
the compiler.
/pdb:<file> Specify debug information file name (default:
output file name with .pdb extension)
/errorendlocation Output line and column of the end location of
each error
/preferreduilang Specify the preferred output language name.
/nostdlib[+|-] Do not reference standard library (mscorlib.dll)
/subsystemversion:<string> Specify subsystem version of this assembly
/lib:<file list> Specify additional directories to search in for
references
/errorreport:<string> Specify how to handle internal compiler errors:
prompt, send, queue, or none. The default is
queue.
/appconfig:<file> Specify an application configuration file
containing assembly binding settings
/moduleassemblyname:<string> Name of the assembly which this module will be
a part of
/modulename:<string> Specify the name of the source module
The accepted answer refers to using System.Private.CoreLib.dll which is a runtime assembly and is not recommended. From C# compiler developer's comments:
Attempting to use runtime assemblies as compile references is not
supported and frequently breaks do to the structure of the runtime
assemblies
Instead, reference assemblies should be used. Reference assemblies are fetched from NuGet during dotnet build and a full csc invocation can be seen when running the dotnet CLI with increased verbosity (dotnet build --verbosity normal). One might see references to assemblies like System.Runtime.dll and System.Console.dll from microsoft.netcore.app NuGet package.
However, for a simple single file Hello, World! compilation, one can reference netstandard.dll which for .NET Core 2.2 exists under <installation-directory>/sdk/2.2.203/ref/netstandard.dll.
Note that in order to run the resulting executable with dotnet HelloWorld.exe a corresponding HelloWorld.runtimeconfig.json has to be created, containing the targeting .NET Core runtime version. We will simplify it by creating a common runtimeconfig for console (NETCoreApp) apps, and an accompanying alias csc_run.
Add the following in your ~/.profile:
#!/usr/bin/env sh
# IMPORTANT: make sure dotnet is present in PATH before the next lines
# prepare csc alias
DOTNETDIR=$(dirname $(dirname $(dotnet --info | grep "Base Path" | cut -d' ' -f 6)))
CSCPATH=$(find $DOTNETDIR -name csc.dll -print | sort | tail -n1)
NETSTANDARDPATH=$(find $DOTNETDIR -path *sdk/*/ref/netstandard.dll ! -path *NuGetFallback* -print | sort | tail -n1)
alias csc='dotnet $CSCPATH /r:$NETSTANDARDPATH '
# prepare csc_run alias
if [ ! -w "$DOTNETDIR" ]; then
mkdir -p $HOME/.dotnet
DOTNETDIR=$HOME/.dotnet
fi
DOTNETCSCRUNTIMECONFIG=$DOTNETDIR/csc-console-apps.runtimeconfig.json
alias csc_run='dotnet exec --runtimeconfig $DOTNETCSCRUNTIMECONFIG '
if [ ! -f $DOTNETCSCRUNTIMECONFIG ]; then
DOTNETRUNTIMEVERSION=$(dotnet --list-runtimes |
grep Microsoft\.NETCore\.App | tail -1 | cut -d' ' -f2)
cat << EOF > $DOTNETCSCRUNTIMECONFIG
{
"runtimeOptions": {
"framework": {
"name": "Microsoft.NETCore.App",
"version": "$DOTNETRUNTIMEVERSION"
}
}
}
EOF
fi
Exit and start shell to reload profile (or source it . ~/.profile if you don't want to leave the current session).
Usage:
cat << EOF > ./Program.cs
class Program
{
static void Main() => System.Console.WriteLine("Hello World!");
}
EOF
csc -out:hwapp.exe Program.cs
csc_run hwapp.exe
# Hello World!
The compiler can be directly invoked using
$ /usr/local/share/dotnet/sdk/2.0.0/Roslyn/RunCsc.sh
However, this particular command may not be very helpful without a supporting project infrastructure because you'd need to pass in all .NET Core or .NET Standard reference assemblies in manually, which is normally handled by the SDK and NuGet. You'll get errors like this:
$ /usr/local/share/dotnet/sdk/2.0.0/Roslyn/RunCsc.sh Program.cs
Microsoft (R) Visual C# Compiler version 2.3.2.61921 (ad0efbb6)
Copyright (C) Microsoft Corporation. All rights reserved.
Program.cs(1,7): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
Program.cs(5,11): error CS0518: Predefined type 'System.Object' is not defined or imported
Program.cs(7,26): error CS0518: Predefined type 'System.String' is not defined or imported
Program.cs(7,16): error CS0518: Predefined type 'System.Void' is not defined or imported
This is the scripts:
#!/bin/bash
#dotnethome=`dirname "$0"`
dotnethome=`dirname \`which dotnet\``
sdkver=$(dotnet --version)
fwkver=$(dotnet --list-runtimes | grep Microsoft.NETCore.App | awk '{printf("%s", $2)}')
dotnetlib=$dotnethome/shared/Microsoft.NETCore.App/$fwkver
if [ "$#" -lt 1 ]; then
dotnet $dotnethome/sdk/$sdkver/Roslyn/bincore/csc.dll -help
echo dotnethome=$dotnethome
echo sdkver=$sdkver
echo fwkver=$fwkver
echo dotnetlib=$dotnetlib
exit 1
fi
progfile=$1
prog="${progfile%.*}"
echo -r:$dotnetlib/netstandard.dll > /tmp/$prog.rsp
echo -r:$dotnetlib/System.dll >> /tmp/$prog.rsp
echo -r:$dotnetlib/Microsoft.CSharp.dll >> /tmp/$prog.rsp
for f in $dotnetlib/System.*.dll; do
echo -r:$f >> /tmp/$prog.rsp
done
dotnet $dotnethome/sdk/$sdkver/Roslyn/bincore/csc.dll -out:$prog.dll -nologo #/tmp/$prog.rsp $*
if [ $? -eq 0 ]; then
if test -f "$prog.dll"; then
if ! test -f "$prog.runtime.config"; then
echo "{
\"runtimeOptions\": {
\"framework\": {
\"name\": \"Microsoft.NETCore.App\",
\"version\": \"$fwkver\"
}
}
}" > "$prog.runtimeconfig.json"
fi
fi
fi
echo /tmp/$prog.rsp:
cat /tmp/$prog.rsp
rm /tmp/$prog.rsp
In short, it's not supported without a predefined project.
But #Andrew's comment shows that it's still possible if you are ready to list every single dependency including implicit system ones in command line options.
From error CS0518: Predefined type 'System.Object' is not defined or imported #12393:
At the moment, we have no plan to make it easy to use csc.exe in this
manner. The guidance is to use the dotnet CLI tooling for the time
being. Even if some modification where to be made here, it would be on
the framework to provide unified and/or simplified reference
assemblies for the compiler. The compiler will never have more
complicated type or assembly resolution than it does now (by design).
See also the closed Make it possible to invoke the compiler directly #7689.
Related
I'm trying to build the C# wrappers for RDKit, but have been struggling to make progress. I've attempted two routes:
n.b. This question is long and unhelpful. Long story short use NuGet (see answer below).
Attempt One
Docs from RDKit /Code/JavaWrappers/csharp_wrapper
The first one is found in https://github.com/rdkit/rdkit.
There are C# wrappers with build instructions in ./Code/JavaWrappers/csharp_wrapper found at: https://github.com/rdkit/rdkit/tree/master/Code/JavaWrappers/csharp_wrapper
My first attempt to compile the wrappers involved manually trying to build these. Following this README: https://github.com/rdkit/rdkit/blob/master/Code/JavaWrappers/csharp_wrapper/README
To build on Windows:
Since cmake doesn't know anything about C#, there's an unfortunate
manual step involved in this.
Make sure that the cmake configuration variable
RDK_BUILD_SWIG_CSHARP_WRAPPER is set to ON.
Run cmake to generate the solution file and open it in Visual
Studio.
Select the option to add an existing project and add
$RDBASE/Code/JavaWrappers/csharp_wrapper/RDKit2DotNet.csproj
Right click on the added project (named RDKit2DotNet) and add a
dependency to RDKFuncs (this is the project that creates the C++
dll that the C# project needs)
Build the RDKit2DotNet project.
Your bin directory
($RDBASE/Code/JavaWrappers/csharp_wrapper/bin/Release if you did a
release build) now contains two DLLs:
- RDKFuncs.dll is the C++ dll containing the RDKit functionality
- RDKit2DotNet.dll contains the C# wrapper. To use the wrappers in your own projects, you should copy both dlls into your project
directory and add a reference to RDKit2DotNet.dll
The directory RDKitCSharpTest contains a sample test project and some
code that makes very basic use of the wrapper functionality.
To get cmake to run I updated the CMakeLists.txt to tell it how to find swig and to set RDK_BUILD_SWIG_CSHARP_WRAPPER ON as follows:
cmake_minimum_required(VERSION 3.14)
project (GraphMolCSharp)
set(SWIG_FOUND TRUE) # This has been added
set(SWIG_DIR ${CMAKE_CURRENT_SOURCE_DIR}) # This has been added
set(SWIG_EXECUTABLE swig.exe) # This has been added
set(SWIG_VERSION 4.0) # This has been added
find_package (SWIG) # This has been added
include (UseSWIG) # This has been added
include_directories( ${RDKit_ExternalDir} )
SET(RDK_BUILD_SWIG_CSHARP_WRAPPER ON) # This has been added
# find the gmcs executables on non-windows systems:
if(NOT WIN32)
find_program(GMCS_EXE gmcs)
if (NOT GMCS_EXE)
MESSAGE ("gmcs (executable) is not found. Please add it to PATH and rerun cmake.")
MESSAGE(FATAL_ERROR "Cannot find required executable gmcs")
endif (NOT GMCS_EXE)
endif(NOT WIN32)
SET_SOURCE_FILES_PROPERTIES(GraphMolCSharp.i PROPERTIES CPLUSPLUS ON )
# Setup a few variables for environment-specific things
if(WIN32)
ADD_DEFINITIONS("/W3 /wd4716 /bigobj")
SET(PATH_SEP ";")
SET(COPY_CMD xcopy ${COPY_SOURCE} ${COPY_DEST} /Y /I)
else()
SET(PATH_SEP ":")
SET(COPY_CMD cp -p ${COPY_SOURCE} ${COPY_DEST})
endif()
# Coax SWIG into playing nicely with Apple environments
if(APPLE)
SET(CMAKE_SIZEOF_VOID_P 4)
endif(APPLE)
if(CMAKE_SIZEOF_VOID_P MATCHES 4)
SET(CMAKE_SWIG_FLAGS -namespace "GraphMolWrap")
else()
if (WIN32)
SET(CMAKE_SWIG_FLAGS -namespace "GraphMolWrap" "-DSWIGWORDSIZE64" "-DSWIGWIN")
else()
SET(CMAKE_SWIG_FLAGS -namespace "GraphMolWrap" "-DSWIGWORDSIZE64")
endif()
endif()
SET(CMAKE_SWIG_OUTDIR ${CMAKE_CURRENT_SOURCE_DIR}/swig_csharp )
if(RDK_BUILD_INCHI_SUPPORT)
SET(CMAKE_SWIG_FLAGS "-DRDK_BUILD_INCHI_SUPPORT" ${CMAKE_SWIG_FLAGS} )
endif()
if(RDK_BUILD_AVALON_SUPPORT)
SET(CMAKE_SWIG_FLAGS "-DRDK_BUILD_AVALON_SUPPORT" ${CMAKE_SWIG_FLAGS} )
endif()
FILE(GLOB SWIG_SRC_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../*.i")
# we added all source files, now remove the ones that we're not supporting in this build:
if(NOT RDK_BUILD_AVALON_SUPPORT)
LIST(REMOVE_ITEM SWIG_SRC_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../AvalonLib.i")
endif()
if(NOT RDK_BUILD_INCHI_SUPPORT)
LIST(REMOVE_ITEM SWIG_SRC_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../Inchi.i")
endif()
SET(SWIG_MODULE_RDKFuncs_EXTRA_DEPS ${SWIG_SRC_FILES} )
SWIG_ADD_LIBRARY(RDKFuncs TYPE MODULE LANGUAGE CSharp SOURCES GraphMolCSharp.i )
# it doesnt seem like the threading libs should need to be here, but
# as of Oct 2012 using boost 1.51 under at least ubuntu 12.04 we get a
# link error if they aren't there.
SWIG_LINK_LIBRARIES(RDKFuncs ${RDKit_Wrapper_Libs}
${RDKit_THREAD_LIBS} )
INSTALL(TARGETS RDKFuncs
DESTINATION ${CMAKE_CURRENT_SOURCE_DIR} )
if(NOT WIN32)
# code adapted from the wrapper code for
# GDCM: http://gdcm.svn.sf.net/viewvc/gdcm/trunk/Wrapping/Java/CMakeLists.txt?view=markup
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/RDKit2DotNet.dll
COMMAND ${CMAKE_COMMAND} -E make_directory swig_csharp
## 1. run this custom command only after swig has been run.
COMMAND ${GMCS_EXE} -out:RDKit2DotNet.dll -t:library "swig_csharp/*.cs"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS "${swig_generated_file_fullname}"
)
ADD_CUSTOM_TARGET(RDKFuncsDLL ALL
DEPENDS RDKFuncs ${CMAKE_CURRENT_SOURCE_DIR}/RDKit2DotNet.dll
COMMENT "building mono dll"
)
endif(NOT WIN32)
This creates a lot of new files and one .sln file called GraphMolCSharp.sln.
I was then able to follow the rest of the steps in the README. I opened GraphMolCSharp.sln and added RDKit2DotNet.csproj as a project and added RDKfuncs as a build dependency. But building this gave a lot of errors in Visual Studio, starting with:
Could not copy the file "D:\Desktop\rdkit-master\Code\JavaWrappers\csharp_wrapper\RDKFuncs.dll" because it was not found. RDKit2DotNet
Then a lot of Unable to find x errors.
If anyone can offer some guidance about anything I might have done wrong please let me know.
Attempt Two
The second uses the build.bat found here: https://github.com/bp-kelley/rdkit-csharp
To start I run:
git clone https://github.com/bp-kelley/rdkit-csharp.git
git clone https://github.com/rdkit/rdkit.git
cd rdkit-csharp
Then I have updated the build.bat to use Visual Studio 16 2019 as follows.
Line 95: cmake -G "Visual Studio 16 2019" -A x64 ...
and
Line 111: cmake -G "Visual Studio 16 2019" ...
If someone is able to offer assistance debugging the output below I'd be most grateful.
I have had to cancel the following line:
Downloading: https://dist.nuget.org/win-x86-commandline/latest/nuget.exe to \Desktop\Build\rdkit-csharp\nuget.exe
^CTerminate batch job (Y/N)? n
But have copied nuget.exe into the expected location.
This is most of the output of running build.bat
**PS D:\Desktop\Build> git clone https://github.com/bp-kelley/rdkit-csharp.git
>> git clone https://github.com/rdkit/rdkit.git
>> cd rdkit-csharp
Cloning into 'rdkit-csharp'...
remote: Enumerating objects: 12, done.
remote: Counting objects: 100% (12/12), done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 64 (delta 5), reused 7 (delta 3), pack-reused 52
Unpacking objects: 100% (64/64), done.
Cloning into 'rdkit'...
remote: Enumerating objects: 83, done.
remote: Counting objects: 100% (83/83), done.
remote: Compressing objects: 100% (60/60), done.
remote: Total 61097 (delta 34), reused 38 (delta 22), pack-reused 61014
Receiving objects: 100% (61097/61097), 148.64 MiB | 8.96 MiB/s, done.
Resolving deltas: 100% (46291/46291), done.
Checking out files: 100% (3478/3478), done.
PS D:\Desktop\Build\rdkit-csharp> .\build.bat
///////// TOO LONG TO POST TO STACKOVERFLOW CUT LINES /////////
D:\Desktop\Build\rdkit-csharp>call get_nuget https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
Downloading: https://dist.nuget.org/win-x86-commandline/latest/nuget.exe to \Desktop\Build\rdkit-csharp\nuget.exe
^CTerminate batch job (Y/N)? n
Running cmake...
Feeds used:
C:\Users\Sarco\.nuget\packages\
https://api.nuget.org/v3/index.json
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
Attempting to gather dependency information for package 'boost-vc140.1.69.0' with respect to project 'D:\Desktop\Build\rdkit-csharp\Nuget.Local', targeting 'Any,Version=v0.0'
///////// TOO LONG TO POST TO STACKOVERFLOW CUT LINES /////////
Build started 11/05/2019 09:36:17.
1>Project "D:\Desktop\Build\rdkit-csharp\build64\ALL_BUILD.vcxproj" on node 1 (Build target(s)).
1>D:\Desktop\Build\rdkit-csharp\build64\ALL_BUILD.vcxproj(32,3): error MSB4019: The imported project "D:\Microsoft
.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the fi
le exists on disk.
1>Done Building Project "D:\Desktop\Build\rdkit-csharp\build64\ALL_BUILD.vcxproj" (Build target(s)) -- FAILED.
Build FAILED.
"D:\Desktop\Build\rdkit-csharp\build64\ALL_BUILD.vcxproj" (Build target) (1) ->
D:\Desktop\Build\rdkit-csharp\build64\ALL_BUILD.vcxproj(32,3): error MSB4019: The imported project "D:\Microso
ft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the
file exists on disk.
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.14
D:\Desktop\Build\rdkit-csharp\build64>copy Code\JavaWrappers\csharp_wrapper\Release\RDKFuncs.dll Code\JavaWrappers\csharp_wrapper
The system cannot find the path specified.
D:\Desktop\Build\rdkit-csharp\build64>copy ..\..\rdkit\Code\JavaWrappers\csharp_wrapper\RDKit2DotNet.csproj Code\JavaWrappers\csharp_wrapper
1 file(s) copied.
D:\Desktop\Build\rdkit-csharp\build64>robocopy ..\..\rdkit\Code\JavaWrappers\csharp_wrapper\swig_csharp Code\JavaWrappers\csharp_wrapper\swig_csharp /E
-------------------------------------------------------------------------------
ROBOCOPY :: Robust File Copy for Windows
-------------------------------------------------------------------------------
Started : 11 May 2019 09:36:17
Source : D:\Desktop\Build\rdkit\Code\JavaWrappers\csharp_wrapper\swig_csharp\
Dest : D:\Desktop\Build\rdkit-csharp\build64\Code\JavaWrappers\csharp_wrapper\swig_csharp\
Files : *.*
Options : *.* /S /E /DCOPY:DA /COPY:DAT /R:1000000 /W:30
------------------------------------------------------------------------------
2019/05/11 09:36:17 ERROR 2 (0x00000002) Accessing Source Directory D:\Desktop\Build\rdkit\Code\JavaWrappers\csharp_wrapper\swig_csharp\
The system cannot find the file specified.
D:\Desktop\Build\rdkit-csharp\build64>copy D:\Desktop\Build\rdkit-csharp\\RDKit.cs Code\JavaWrappers\csharp_wrapper\swig_csharp\RDKit.cs
The system cannot find the path specified.
0 file(s) copied.
D:\Desktop\Build\rdkit-csharp\build64>msbuild "Code\JavaWrappers\csharp_wrapper\RDKit2DotNet.csproj" /m /p:Configuration=Release /maxcpucount:4 /t:Build /p:Platform=AnyCPU
Microsoft (R) Build Engine version 4.7.3056.0
[Microsoft .NET Framework, version 4.0.30319.42000]
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 11/05/2019 09:36:18.
1>Project "D:\Desktop\Build\rdkit-csharp\build64\Code\JavaWrappers\csharp_wrapper\RDKit2DotNet.csproj" on node 1 (
Build target(s)).
1>PrepareForBuild:
Creating directory "bin\Release\".
Creating directory "obj\Release\".
GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect t
o the input files.
CoreCompile:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /errorreport:prom
pt /warn:4 /define:TRACE /highentropyva- /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Fra
mework\.NETFramework\v4.0\Microsoft.CSharp.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Micros
oft\Framework\.NETFramework\v4.0\mscorlib.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microso
ft\Framework\.NETFramework\v4.0\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Micro
soft\Framework\.NETFramework\v4.0\System.Data.DataSetExtensions.dll" /reference:"C:\Program Files (x86)\Refere
nce Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Data.dll" /reference:"C:\Program Files (x86)\Refe
rence Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll" /reference:"C:\Program Files (x86)\Referen
ce Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Xml.dll" /reference:"C:\Program Files (x86)\Refere
nce Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Xml.Linq.dll" /debug:pdbonly /filealign:512 /opti
mize+ /out:obj\Release\RDKit2DotNet.dll /target:library /utf8output
1>CSC : warning CS2008: No source files specified [D:\Desktop\Build\rdkit-csharp\build64\Code\JavaWrappers\csharp_
wrapper\RDKit2DotNet.csproj]
1>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(3713,5): error MSB3030: Could not copy th
e file "D:\Desktop\Build\rdkit-csharp\build64\Code\JavaWrappers\csharp_wrapper\RDKFuncs.dll" because it was not
found. [D:\Desktop\Build\rdkit-csharp\build64\Code\JavaWrappers\csharp_wrapper\RDKit2DotNet.csproj]
1>Done Building Project "D:\Desktop\Build\rdkit-csharp\build64\Code\JavaWrappers\csharp_wrapper\RDKit2DotNet.cspro
j" (Build target(s)) -- FAILED.
Build FAILED.
"D:\Desktop\Build\rdkit-csharp\build64\Code\JavaWrappers\csharp_wrapper\RDKit2DotNet.csproj" (Build target) (1)
->
(CoreCompile target) ->
CSC : warning CS2008: No source files specified [D:\Desktop\Build\rdkit-csharp\build64\Code\JavaWrappers\cshar
p_wrapper\RDKit2DotNet.csproj]
"D:\Desktop\Build\rdkit-csharp\build64\Code\JavaWrappers\csharp_wrapper\RDKit2DotNet.csproj" (Build target) (1)
->
(_CopyOutOfDateSourceItemsToOutputDirectoryAlways target) ->
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(3713,5): error MSB3030: Could not copy
the file "D:\Desktop\Build\rdkit-csharp\build64\Code\JavaWrappers\csharp_wrapper\RDKFuncs.dll" because it was no
t found. [D:\Desktop\Build\rdkit-csharp\build64\Code\JavaWrappers\csharp_wrapper\RDKit2DotNet.csproj]
1 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.63
///////// TOO LONG TO POST TO STACKOVERFLOW CUT LINES /////////
-- Using unsigned short
-- Check if the system is big endian - little endian
-- Found Catch2 source in D:/Desktop/Build/rdkit/External/catch/catch
CATCH: D:/Desktop/Build/rdkit/External/catch/catch/single_include
-- Could NOT find InChI in system locations (missing: INCHI_LIBRARY INCHI_INCLUDE_DIR)
CUSTOM_INCHI_PATH = D:/Desktop/Build/rdkit/External/INCHI-API
-- Found InChI software locally
-- Boost version: 1.69.0
-- Looking for pthread.h
///////// TOO LONG TO POST TO STACKOVERFLOW CUT LINES /////////
in D:/Desktop/Build/rdkit/External/CoordGen/maeparser
CMake Error at D:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:2147 (message):
Unable to find the requested Boost libraries.
Boost version: 1.69.0
Boost include path:
D:/Desktop/Build/rdkit-csharp/Nuget.Local/boost.1.69.0.0/lib/native/include
Could not find the following Boost libraries:
boost_system
boost_iostreams
Some (but not all) of the required Boost libraries were found. You may
need to install these additional Boost libraries. Alternatively, set
BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT
to the location of Boost.
Call Stack (most recent call first):
External/CoordGen/CMakeLists.txt:39 (find_package)
-- coordgen include dir set as coordgen_INCLUDE_DIRS-NOTFOUND
-- coordgen libraries set as 'coordgen_LIBRARIES-NOTFOUND'
-- coordgen templates file set as 'coordgen_TEMPLATE_FILE-NOTFOUND'
-- Could NOT find coordgen (missing: coordgen_INCLUDE_DIRS coordgen_LIBRARIES coordgen_TEMPLATE_FILE)
-- Found coordgenlibs source in D:/Desktop/Build/rdkit/External/CoordGen/coordgen
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
CMake Error at D:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:2147 (message):
Unable to find the requested Boost libraries.
Boost version: 1.69.0
Boost include path:
D:/Desktop/Build/rdkit-csharp/Nuget.Local/boost.1.69.0.0/lib/native/include
Could not find the following Boost libraries:
boost_system
boost_iostreams
Some (but not all) of the required Boost libraries were found. You may
need to install these additional Boost libraries. Alternatively, set
BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT
to the location of Boost.
Call Stack (most recent call first):
Code/RDStreams/CMakeLists.txt:4 (find_package)
-- Could NOT find Boost
CMake Error at D:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:2147 (message):
Unable to find the requested Boost libraries.
Boost version: 1.69.0
Boost include path:
D:/Desktop/Build/rdkit-csharp/Nuget.Local/boost.1.69.0.0/lib/native/include
Could not find the following Boost libraries:
boost_system
boost_iostreams
Some (but not all) of the required Boost libraries were found. You may
need to install these additional Boost libraries. Alternatively, set
BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT
to the location of Boost.
Call Stack (most recent call first):
Code/GraphMol/FileParsers/CMakeLists.txt:7 (find_package)
-- Could NOT find Boost
== Making EnumerateLibrary without boost Serialization support
== Making FilterCatalog without boost Serialization support
-- Found PythonInterp: D:/Program Files/Python36-32/python.exe (found version "3.6.3")
== Updating Filters.cpp from pains file
== Done updating pains files
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- Found Cairo: D:/Desktop/Build/rdkit-csharp/Nuget.Local/cairo.1.12.18.0/build/native/include
== Making SubstructLibrary without boost Serialization support
-- Found RapidJSON source in D:/Desktop/Build/rdkit/External
-- Found SWIG: C:/swig/swig.exe (found version "4.0.0")
CMake Error at D:/Program Files/CMake/share/cmake-3.14/Modules/FindBoost.cmake:2147 (message):
Unable to find the requested Boost libraries.
Boost version: 1.69.0
Boost include path:
D:/Desktop/Build/rdkit-csharp/Nuget.Local/boost.1.69.0.0/lib/native/include
Could not find the following Boost libraries:
boost_system
boost_iostreams
Some (but not all) of the required Boost libraries were found. You may
need to install these additional Boost libraries. Alternatively, set
BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT
to the location of Boost.
Call Stack (most recent call first):
Code/JavaWrappers/CMakeLists.txt:43 (find_package)
-- Could NOT find Boost
SUFFIX:
JAVA_LIBS: AvalonLib;avalon_clib;RDInchiLib;Inchi;RGroupDecomposition;SubstructLibrary;MolStandardize;FilterCatalog;Catalogs;FMCS;MolDraw2D;FileParsers;SmilesParse;Depictor;SubstructMatch;ChemReactions;Fingerprints;ChemTransforms;Subgraphs;GraphMol;DataStructs;Trajectory;Descriptors;PartialCharges;MolTransforms;DistGeomHelpers;DistGeometry;ForceFieldHelpers;ForceField;EigenSolvers;Optimizer;MolAlign;Alignment;SimDivPickers;RDGeometryLib;RDStreams;RDGeneral
CMake Warning (dev) at D:/Program Files/CMake/share/cmake-3.14/Modules/UseSWIG.cmake:600 (message):
Policy CMP0078 is not set: UseSWIG generates standard target names. Run
"cmake --help-policy CMP0078" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
Call Stack (most recent call first):
Code/JavaWrappers/csharp_wrapper/CMakeLists.txt:63 (SWIG_ADD_LIBRARY)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at D:/Program Files/CMake/share/cmake-3.14/Modules/UseSWIG.cmake:460 (message):
Policy CMP0086 is not set: UseSWIG honors SWIG_MODULE_NAME via -module
flag. Run "cmake --help-policy CMP0086" for policy details. Use the
cmake_policy command to set the policy and suppress this warning.
Call Stack (most recent call first):
D:/Program Files/CMake/share/cmake-3.14/Modules/UseSWIG.cmake:695 (SWIG_ADD_SOURCE_TO_MODULE)
Code/JavaWrappers/csharp_wrapper/CMakeLists.txt:63 (SWIG_ADD_LIBRARY)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Configuring incomplete, errors occurred!
See also "D:/Desktop/Build/rdkit-csharp/build32/CMakeFiles/CMakeOutput.log".
See also "D:/Desktop/Build/rdkit-csharp/build32/CMakeFiles/CMakeError.log".
D:\Desktop\Build\rdkit-csharp\build32>msbuild "ALL_BUILD.vcxproj" /m /p:PlatformTarget=x86 /p:Configuration=Release /maxcpucount:4 /t:Build
Microsoft (R) Build Engine version 4.7.3056.0
[Microsoft .NET Framework, version 4.0.30319.42000]
Copyright (C) Microsoft Corporation. All rights reserved.
MSBUILD : error MSB1009: Project file does not exist.
Switch: ALL_BUILD.vcxproj
D:\Desktop\Build\rdkit-csharp\build32>copy Code\JavaWrappers\csharp_wrapper\Release\RDKFuncs.dll Code\JavaWrappers\csharp_wrapper
The system cannot find the path specified.
D:\Desktop\Build\rdkit-csharp\build32>copy ..\..\rdkit\Code\JavaWrappers\csharp_wrapper\RDKit2DotNet.csproj Code\JavaWrappers\csharp_wrapper
1 file(s) copied.
D:\Desktop\Build\rdkit-csharp\build32>robocopy ..\..\rdkit\Code\JavaWrappers\csharp_wrapper\swig_csharp Code\JavaWrappers\csharp_wrapper\swig_csharp /E
-------------------------------------------------------------------------------
ROBOCOPY :: Robust File Copy for Windows
-------------------------------------------------------------------------------
Started : 11 May 2019 09:36:36
Source : D:\Desktop\Build\rdkit\Code\JavaWrappers\csharp_wrapper\swig_csharp\
Dest : D:\Desktop\Build\rdkit-csharp\build32\Code\JavaWrappers\csharp_wrapper\swig_csharp\
Files : *.*
Options : *.* /S /E /DCOPY:DA /COPY:DAT /R:1000000 /W:30
------------------------------------------------------------------------------
2019/05/11 09:36:36 ERROR 2 (0x00000002) Accessing Source Directory D:\Desktop\Build\rdkit\Code\JavaWrappers\csharp_wrapper\swig_csharp\
The system cannot find the file specified.
D:\Desktop\Build\rdkit-csharp\build32>copy D:\Desktop\Build\rdkit-csharp\\RDKit.cs Code\JavaWrappers\csharp_wrapper\swig_csharp\RDKit.cs
The system cannot find the path specified.
0 file(s) copied.
D:\Desktop\Build\rdkit-csharp\build32>msbuild "Code\JavaWrappers\csharp_wrapper\RDKit2DotNet.csproj" /m /p:Configuration=Release /maxcpucount:4 /t:Build /p:Platform=AnyCPU
Microsoft (R) Build Engine version 4.7.3056.0
[Microsoft .NET Framework, version 4.0.30319.42000]
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 11/05/2019 09:36:36.
1>Project "D:\Desktop\Build\rdkit-csharp\build32\Code\JavaWrappers\csharp_wrapper\RDKit2DotNet.csproj" on node 1 (
Build target(s)).
1>PrepareForBuild:
Creating directory "bin\Release\".
Creating directory "obj\Release\".
GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect t
o the input files.
CoreCompile:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /errorreport:prom
pt /warn:4 /define:TRACE /highentropyva- /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Fra
mework\.NETFramework\v4.0\Microsoft.CSharp.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Micros
oft\Framework\.NETFramework\v4.0\mscorlib.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microso
ft\Framework\.NETFramework\v4.0\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Micro
soft\Framework\.NETFramework\v4.0\System.Data.DataSetExtensions.dll" /reference:"C:\Program Files (x86)\Refere
nce Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Data.dll" /reference:"C:\Program Files (x86)\Refe
rence Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll" /reference:"C:\Program Files (x86)\Referen
ce Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Xml.dll" /reference:"C:\Program Files (x86)\Refere
nce Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Xml.Linq.dll" /debug:pdbonly /filealign:512 /opti
mize+ /out:obj\Release\RDKit2DotNet.dll /target:library /utf8output
1>CSC : warning CS2008: No source files specified [D:\Desktop\Build\rdkit-csharp\build32\Code\JavaWrappers\csharp_
wrapper\RDKit2DotNet.csproj]
1>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(3713,5): error MSB3030: Could not copy th
e file "D:\Desktop\Build\rdkit-csharp\build32\Code\JavaWrappers\csharp_wrapper\RDKFuncs.dll" because it was not
found. [D:\Desktop\Build\rdkit-csharp\build32\Code\JavaWrappers\csharp_wrapper\RDKit2DotNet.csproj]
1>Done Building Project "D:\Desktop\Build\rdkit-csharp\build32\Code\JavaWrappers\csharp_wrapper\RDKit2DotNet.cspro
j" (Build target(s)) -- FAILED.
Build FAILED.
"D:\Desktop\Build\rdkit-csharp\build32\Code\JavaWrappers\csharp_wrapper\RDKit2DotNet.csproj" (Build target) (1)
->
(CoreCompile target) ->
CSC : warning CS2008: No source files specified [D:\Desktop\Build\rdkit-csharp\build32\Code\JavaWrappers\cshar
p_wrapper\RDKit2DotNet.csproj]
"D:\Desktop\Build\rdkit-csharp\build32\Code\JavaWrappers\csharp_wrapper\RDKit2DotNet.csproj" (Build target) (1)
->
(_CopyOutOfDateSourceItemsToOutputDirectoryAlways target) ->
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(3713,5): error MSB3030: Could not copy
the file "D:\Desktop\Build\rdkit-csharp\build32\Code\JavaWrappers\csharp_wrapper\RDKFuncs.dll" because it was no
t found. [D:\Desktop\Build\rdkit-csharp\build32\Code\JavaWrappers\csharp_wrapper\RDKit2DotNet.csproj]
1 Warning(s)**
Never did manage manually compile the RDKit DotNet Wrapper.
However I did find a NuGet package for an old version that did what I need it to:
https://www.nuget.org/packages/RDKit2DotNet/2017.9.1-alpha1
Install-Package RDKit2DotNet -Version 2017.9.1-alpha1
Update
There is now a newer version which works perfectly:
https://www.nuget.org/packages/RDKit.DotNetWrap/
Install-Package RDKit.DotNetWrap -Version 0.2019033.1
I am doing automation using selenium and c#. Everything is running file when I run from visual studio but getting issue in file path then run via jenkins.
Batch command I am trying :
"nuget.exe" restore UnitTestProject1.sln
"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe" UnitTestProject1.sln
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\MSTest.exe" /testcontainer:UnitTestProject1\bin\Debug\UnitTestProject1.dll
Output from Jenkins :
Building in workspace C:\Users\developer\.jenkins\workspace\LinkedinAutomation\UnitTestProject1
[UnitTestProject1] $ cmd /c call C:\Users\developer\AppData\Local\Temp\jenkins934555759751738078.bat
C:\Users\developer\.jenkins\workspace\LinkedinAutomation\UnitTestProject1>"nuget.exe" restore UnitTestProject1.sln
MSBuild auto-detection: using msbuild version '15.5.180.51428' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\bin'.
All packages listed in packages.config are already installed.
C:\Users\developer\.jenkins\workspace\LinkedinAutomation\UnitTestProject1>"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe" UnitTestProject1.sln
Microsoft (R) Build Engine version 4.6.1055.0
[Microsoft .NET Framework, version 4.0.30319.42000]
Copyright (C) Microsoft Corporation. All rights reserved.
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 3/5/2018 6:38:36 PM.
Project "C:\Users\developer\.jenkins\workspace\LinkedinAutomation\UnitTestProject1\UnitTestProject1.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
Building solution configuration "Debug|Any CPU".
Project "C:\Users\developer\.jenkins\workspace\LinkedinAutomation\UnitTestProject1\UnitTestProject1.sln" (1) is building "C:\Users\developer\.jenkins\workspace\LinkedinAutomation\UnitTestProject1\UnitTestProject1\UnitTestProject1.csproj" (2) on node 1 (default targets).
Project file contains ToolsVersion="15.0". This toolset may be unknown or missing, in which case you may be able to resolve this by installing the appropriate version of MSBuild, or the build may have been forced to a particular ToolsVersion for policy reasons. Treating the project as if it had ToolsVersion="4.0". For more information, please see http://go.microsoft.com/fwlink/?LinkId=291333.
GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
CoreCompile:
Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.
_CopyOutOfDateSourceItemsToOutputDirectory:
Skipping target "_CopyOutOfDateSourceItemsToOutputDirectory" because all output files are up-to-date with respect to the input files.
_CopyAppConfigFile:
Skipping target "_CopyAppConfigFile" because all output files are up-to-date with respect to the input files.
CopyFilesToOutputDirectory:
UnitTestProject1 -> C:\Users\developer\.jenkins\workspace\LinkedinAutomation\UnitTestProject1\UnitTestProject1\bin\Debug\UnitTestProject1.dll
Done Building Project "C:\Users\developer\.jenkins\workspace\LinkedinAutomation\UnitTestProject1\UnitTestProject1\UnitTestProject1.csproj" (default targets).
Done Building Project "C:\Users\developer\.jenkins\workspace\LinkedinAutomation\UnitTestProject1\UnitTestProject1.sln" (default targets).
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:01.03
C:\Users\developer\.jenkins\workspace\LinkedinAutomation\UnitTestProject1>"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\MSTest.exe"
Microsoft (R) Test Execution Command Line Tool Version 15.0.27019.1
Copyright (c) Microsoft Corporation. All rights reserved.
Please specify tests to run, or specify the /publish switch to publish results.
For switch syntax, type "MSTest /help"
C:\Users\developer\.jenkins\workspace\LinkedinAutomation\UnitTestProject1>/testcontainer:UnitTestProject1.dll
The filename, directory name, or volume label syntax is incorrect.
C:\Users\developer\.jenkins\workspace\LinkedinAutomation\UnitTestProject1>exit 123
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE
It seems everything is fine till end. It has issue in finding project dll file at end with test container.
I have the following set as a Windows Batch command:
. This is one long line that runs the individual project Test DLLs of our components. Each DLL is from a Unit Test Project.
It appears that your command line has forward slashes, and not the Windows directory separator, the backslash.
I have also found that I needed a different command line to get my tests running properly. I had to use the vstest.console.exe to run the tests.
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" Application_Tests\bin\Release\Application_Tests.dll AppLib_Tests\bin\Release\AppLib_Tests.dll
For the full command line: vstest.console.exe command line
I'm having trouble running a scann for my c# app, I'm trying to scan a simple console application. but everytime I run my analysis I get this:
16:00:04.919 16:00:04.919 Unrecognized command line argument: /t:Rebuild
So here's the complete command since the beginning:
PS C:\Users\danie\documents\Visual Studio 2015\Projects\ConsoleApplication1> C:\SonarQube-Scanner-for-MSBuild\SonarQube.Scanner.MSBuild.exe begin /k:"ConsoleApplication1" /n:"ConsoleApplication1"/v:"1.0"
SonarQube Scanner for MSBuild 4.0.2
Default properties file was found at C:\SonarQube-Scanner-for-
MSBuild\SonarQube.Analysis.xml
Loading analysis properties from C:\SonarQube-Scanner-for-
MSBuild\SonarQube.Analysis.xml
Pre-processing started.
Preparing working directories...
16:13:12.659 Updating build integration targets...
16:13:12.674 Fetching analysis configuration settings...
16:13:13.051 Provisioning analyzer assemblies for cs...
16:13:13.052 Installing required Roslyn analyzers...
16:13:13.152 Pre-processing succeeded.
PS C:\Users\danie\documents\Visual Studio 2015\Projects\ConsoleApplication1>
C:\SonarQube-Scanner-for-MSBuild\SonarQube.Scanner.MSBuild.exe /t:Rebuild
SonarQube Scanner for MSBuild 4.0.2
Default properties file was found at C:\SonarQube-Scanner-for-
MSBuild\SonarQube.Analysis.xml
Loading analysis properties from C:\SonarQube-Scanner-for-
MSBuild\SonarQube.Analysis.xml
WARNING: Please specify the command 'begin' or 'end' to indicate whether
pre- or post-processing is required. These parameters will become mandatory
in a later release.
Pre-processing started.
Preparing working directories...
16:13:17.069 16:13:17.053 Unrecognized command line argument: /t:Rebuild
16:13:17.069 16:13:17.053 A required argument is missing: /key:[SonarQube
project key]
16:13:17.069 Expecting at least the following command line argument:
- SonarQube project key
When connecting to a SonarQube server earlier than version 6.1, the following command line arguments are also required:
- SonarQube project name
- SonarQube project version
The full path to a settings file can also be supplied. If it is not supplied, the exe will attempt to locate a default settings file in the same directory as the SonarQube Scanner for MSBuild.
Use '/?' or '/h' to see the help message.
16:13:17.084 Pre-processing failed. Exit code: 1
Any help fixing this will be appreciatted!
Thanks.
PD: I'm running sonarqube version 6.7.1 and MSBuild
The second command you execute should be just msbuild.exe, not SonarQube.Scanner.MSBuild.exe.
Edit:
The problem, is indeed that I have to execute MSBuild.exe instead of the other one but if you can't execute that, it may be because you don't haven't configured your environment varables, and path. If you can't execute it simply look for your MSBuild folder in Program Files (x86), in the end you should execute this:
'C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe' /t:Rebuild
so this should be it.
this is msbuild log
Output file "obj\Debug\ProjectName.dll.licenses" does not exist.
Using "LC" task from assembly "Microsoft.Build.Tasks.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Task "LC"
Task attempted to find "LC.exe" using the SdkToolsPath value "". Make sure the SdkToolsPath is set to the correct value and the tool exists in the correct processor specific location below it.
"C:\Program Files\Microsoft SDKs\Windows\v7.1\bin\NetFX 4.0 Tools\LC.exe" /target:...
Microsoft (R) .NET License Compiler
[Microsoft .Net Framework, Version 4.0.30319.34209]
Copyright (c) Microsoft Corporation. All rights reserved.
Generates a .NET Licenses file and adds it to the manifest of the given assembly
Usage:
lc /target:TargetAssembly /complist:filename [/outdir:path] [/i:modules] [/v] [/nologo]
Options:
/target: Target assembly for the generated licenses file
/complist: Licensed component list file
/outdir: Output directory for the generated licenses >file
/i: Specify modules to load
/v Verbose output
/nologo Suppress the display of the startup banner
Done executing task "LC".
How is that possible? No errors on compile time and no compile result?
Log looks like wrong command line(default help), but it's not true
I copied all command about LC.exe...
"C:\Program Files\Microsoft SDKs\Windows\v7.1\bin\NetFX 4.0
Tools\LC.exe" /target:...
And that's work when called from command line, successfully generate file *dll.licenses
Specified path exists! - C:\Program Files\Microsoft SDKs\Windows\v7.1\bin\NetFX 4.0 Tools\LC.exe
SDK installed, path in registry correct
Why does not work when called from msbuild?
I have a .net application built on .net framework 3.5, I am trying to build this application on Jenkins CI server. I've added MSBuild plugin and and have added path to the .exe file of 2.0, 3.5 and 4.0 versions of MSBuild. But my building processes are failing by showing the below error message.
Path To MSBuild.exe: msbuild.exe
Executing command: cmd.exe /C msbuild.exe Neo.sln && exit %%ERRORLEVEL%%
[Test project] $ cmd.exe /C msbuild.exe Neo.sln && exit %%ERRORLEVEL%%
'msbuild.exe' is not recognized as an internal or external command,
operable program or batch file.
Build step 'Build a Visual Studio project or solution using MSBuild.' marked uild as failure
Finished: FAILURE
Could anyone plz help me out..??
To make the MSBuild plugin work, you need to configure the plugin in the Jenkins management screen.
NOTE: in the newer Jenkins versions you find the MSBuild configuration in the Global Tool Configuration:
Note the "Name" field, where I've called this particular configuration v4.0.30319. You could call it anything you like, but ideally the name will somehow refer to the version.
You'll need to refer to this name later in the Jenkins PROJECT that's failing.
Note: The yellow warning implies that the Path to MSBuild field should be populated with a directory name rather than a file name. In practice you do need to enter the filename here too (ie. msbuild.exe) or the build step will fail.
In the Jenkins project that's failing, go to the MSBuild build step.
The first field in the build step is "MSBuild Version". If you created the build step before configuring any MSBuild versions, the value here will be (default).
After configuring one or more MSBuild versions, the drop down will be populated with the available configurations. Select the one you require.
You can see here that I've now selected the named configuration that matches the installation above.
Jenkins | Manage Jenkins | Configure System
scroll down to the MSBuild section and click MSBuild installations
define the full path to msbuild.exe, on my system I have 3.5 and v4.0.30319
Note - specify the path to 32-bit tools even on a 64-bit system, otherwise you might get an error message:
Building Windows Phone application using MSBuild 64 bit is not supported.
So in Jenkins - it could be for example:
Name: Version 3.5
Path: C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe
Name: Version 4.0
Path: C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSbuild.exe
I think you should set an absolute path for "msbuild.exe" in your Jenkins configuration,
for example:
C:\Windows\Microsoft.NET\Framework\v3.5\msbuild.exe
You can also add the path where the msbuild.exe is, to the PATH system environment variable of the node (or nodes) that is running that specific job.
You could try executing the
%comspec% /k ""c:\Program Files\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" x86
command, which will temporarily update your environment path variables to reflect the VS2010 build environment. Execute this before you call MSBUILD and see what happens. I use this in my own build scripts with no issues.
Side note; it's very likely counterproductive to have multiple versions of MSBUILD on your PATH. Concentrate on getting one version working and go from there.