ILMerge, .NET 4, NuGet: Unresolved assembly reference not allowed: CommandLine - .net-4.0

ILMerge, .NET 4, NuGet: Unresolved assembly reference not allowed: CommandLine
I'm trying to pack my project into single dll.
I'm using:
- Visual Studio 2015
- NuGet
- ILMerge
To achieve my goal, I'd took ILMerge batch file
Added a post-build event:
"d:\#programming\#visual_studio\merge_all.bat" "$(TargetPath)" $(ConfigurationName)
Then slightly modified batch file to get rid of duplicate errors and add some hooks to try to eliminate "Unresolved assembly reference" error.
Unfortunately, none of Google Suggestions
Brought any relief.
So, I still got an error:
Unresolved assembly reference not allowed: CommandLine.
Here's my ILMerge batch file:
#ECHO OFF
rem # usage
rem # "path\to\merge_all.bat" "$(TargetPath)" $(ConfigurationName)
rem # "d:\#programming\#visual_studio\merge_all.bat" "$(TargetPath)" $(ConfigurationName)
rem # set .NET version and output folder name
set net_version=v4
set net_path="C:\Windows\Microsoft.NET\Framework\v4.0.30319"
set net_path_v1="%ProgramFiles%\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client"
set net_path_v2="%ProgramFiles%\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0"
set net_path_v3="%ProgramFiles%\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6"
set target_platform=%net_version%,%net_path_v3%
set lib_path="%ProgramFiles%\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0"
set output=merged
set ILMerge=%ProgramFiles%\Microsoft\ILMerge\ILMerge.exe
rem # parsing arguments
set target_path=%1
set target_file=%~nx1
set target_dir=%~dp1
set ConfigurationName=%2
rem # set output path and result file path
set outdir=%target_dir%%output%
set result=%outdir%\%target_file%
set log_file="%outdir%\merge.log"
set primary_assembly=%target_path%
rem # a little looping voodoo from microsoft to get rid of "duplicate" error
setlocal EnableDelayedExpansion
set "other_assemblies="
for %%f in (%target_dir%*.dll) do (
if NOT %%~nxf==%target_file% (
set "other_assemblies=!other_assemblies! %target_dir%%%~nxf"
)
)
setlocal DisableDelayedExpansion
rem # print info
#echo Start %ConfigurationName% Merging %target_file%.
#echo Target: %target_path%
#echo target_dir: %target_dir%
#echo Config: %ConfigurationName%
#echo Log: %log_file%
#echo primary assembly: %primary_assembly%
#echo other assemblies: %other_assemblies%
rem # recreate outdir
IF EXIST "%outdir%" rmdir /S /Q "%outdir%"
md "%outdir%"
set options= /wildcards /targetplatform:%target_platform% /log:%log_file% /out:"%result%" %primary_assembly% %other_assemblies%
rem # run merge cmd
#echo Merging: '"%ILMerge%" %options%'
"%ILMerge%" %options%
rem # if succeded
IF %ErrorLevel% EQU 0 (
rem # clear real output folder and put there result assembly
IF %ConfigurationName%==Release (
del %target_dir%*.*
del %target_dir%*.dll
del %target_dir%*.pdb
del %target_dir%*.xml
del %target_dir%*.*
copy %result% %target_dir%
rmdir /S /Q %outdir%
set result=%target_path%
#echo Result: %target_file% "-> %target_path%"
) ELSE (
#echo Result: %target_file% "-> %result%" )
set status=succeded
set errlvl=0
) ELSE (
set status=failed
set errlvl=1
)
#echo Merge %status%
exit %errlvl%
Here's the output of build process:
1>------ Rebuild All started: Project: YouTrackSharpApiWrapper, Configuration: Debug Any CPU ------
1>D:\#programming\#visual_studio\YouTrackSharpApiWrapper\ApiWrapper.cs(59,21,59,22): warning CS0168: The variable 'e' is declared but never used
1> YouTrackSharpApiWrapper -> D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\YouTrackSharpApiWrapper.dll
1> Start Debug Merging YouTrackSharpApiWrapper.dll.
1> Target: "D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\YouTrackSharpApiWrapper.dll"
1> target_dir: D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\
1> Config: Debug
1> Log: "D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\merged\merge.log"
1> primary assembly: "D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\YouTrackSharpApiWrapper.dll"
1> other assemblies: D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\EasyHttp.dll D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\JsonFx.dll D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\YouTrackSharp.dll
1> Merging: '"C:\Program Files (x86)\Microsoft\ILMerge\ILMerge.exe" /wildcards /targetplatform:v4,"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6" /log:"D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\merged\merge.log" /out:"D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\merged\YouTrackSharpApiWrapper.dll" "D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\YouTrackSharpApiWrapper.dll" D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\EasyHttp.dll D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\JsonFx.dll D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\YouTrackSharp.dll'
1> Merge failed
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4714,5): error MSB3073: The command ""d:\#programming\#visual_studio\merge_all.bat" "D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\YouTrackSharpApiWrapper.dll" Debug" exited with code 1.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
And here's the log of ILMerge:
ILMerge version 2.12.803.0
Copyright (C) Microsoft Corporation 2004-2006. All rights reserved.
ILMerge /wildcards /targetplatform:v4,C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6 /log:D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\merged\merge.log /out:D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\merged\YouTrackSharpApiWrapper.dll D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\YouTrackSharpApiWrapper.dll D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\EasyHttp.dll D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\JsonFx.dll D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\YouTrackSharp.dll
Set platform to 'v4', using directory 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6' for mscorlib.dll
Running on Microsoft (R) .NET Framework v2.0.50727
mscorlib.dll version = 2.0.0.0
The list of input assemblies is:
D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\YouTrackSharpApiWrapper.dll
D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\EasyHttp.dll
D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\JsonFx.dll
D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\YouTrackSharp.dll
The number of files matching the pattern D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\YouTrackSharpApiWrapper.dll is 1.
D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\YouTrackSharpApiWrapper.dll
Trying to read assembly from the file 'D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\YouTrackSharpApiWrapper.dll'.
Successfully read in assembly.
There were no errors reported in YouTrackSharpApiWrapper's metadata.
The number of files matching the pattern D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\EasyHttp.dll is 1.
D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\EasyHttp.dll
Trying to read assembly from the file 'D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\EasyHttp.dll'.
Successfully read in assembly.
There were no errors reported in EasyHttp's metadata.
The number of files matching the pattern D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\JsonFx.dll is 1.
D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\JsonFx.dll
Trying to read assembly from the file 'D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\JsonFx.dll'.
Can not find PDB file. Debug info will not be available for assembly 'D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\JsonFx.dll'.
Successfully read in assembly.
There were no errors reported in JsonFx's metadata.
The number of files matching the pattern D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\YouTrackSharp.dll is 1.
D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\YouTrackSharp.dll
Trying to read assembly from the file 'D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\YouTrackSharp.dll'.
Successfully read in assembly.
There were no errors reported in YouTrackSharp's metadata.
Checking to see that all of the input assemblies have a compatible PeKind.
YouTrackSharpApiWrapper.PeKind = ILonly
EasyHttp.PeKind = ILonly
JsonFx.PeKind = ILonly
YouTrackSharp.PeKind = ILonly
All input assemblies have a compatible PeKind value.
AssemblyResolver: Assembly 'EasyHttp' is referencing assembly 'System.Core'.
AssemblyResolver: Attempting referencing assembly's directory.
AssemblyResolver: Did not find assembly in referencing assembly's directory.
AssemblyResolver: Attempting input directory.
AssemblyResolver: Did not find assembly in input directory.
AssemblyResolver: Attempting user-supplied directories.
AssemblyResolver: No user-supplied directories.
AssemblyResolver: Attempting framework directory.
Can not find PDB file. Debug info will not be available for assembly 'System.Core'.
Resolved assembly reference 'System.Core' to 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\System.Core.dll'. (Used framework directory.)
AssemblyResolver: Assembly 'YouTrackSharp' is referencing assembly 'System.Management.Automation'.
AssemblyResolver: Attempting referencing assembly's directory.
AssemblyResolver: Did not find assembly in referencing assembly's directory.
AssemblyResolver: Attempting input directory.
AssemblyResolver: Did not find assembly in input directory.
AssemblyResolver: Attempting user-supplied directories.
AssemblyResolver: No user-supplied directories.
AssemblyResolver: Attempting framework directory.
AssemblyResolver: Did not find assembly in framework directory.
AssemblyResolver: Unable to resolve reference. (It still might be found, e.g., in the GAC.)
AssemblyResolver: Assembly 'YouTrackSharp' is referencing assembly 'CommandLine'.
AssemblyResolver: Attempting referencing assembly's directory.
AssemblyResolver: Did not find assembly in referencing assembly's directory.
AssemblyResolver: Attempting input directory.
AssemblyResolver: Did not find assembly in input directory.
AssemblyResolver: Attempting user-supplied directories.
AssemblyResolver: No user-supplied directories.
AssemblyResolver: Attempting framework directory.
AssemblyResolver: Did not find assembly in framework directory.
AssemblyResolver: Unable to resolve reference. (It still might be found, e.g., in the GAC.)
Using assembly 'YouTrackSharpApiWrapper' for assembly-level attributes for the target assembly.
Merging assembly 'YouTrackSharpApiWrapper' into target assembly.
Merging assembly 'EasyHttp' into target assembly.
Merging assembly 'JsonFx' into target assembly.
Assembly level attribute 'System.Security.AllowPartiallyTrustedCallersAttribute' from assembly 'JsonFx' being deleted from target assembly
Merging assembly 'YouTrackSharp' into target assembly.
Copying 1 Win32 Resources from assembly 'YouTrackSharpApiWrapper' into target assembly.
There were no errors reported in the target assembly's metadata.
ILMerge: Writing target assembly 'D:\#programming\#visual_studio\YouTrackSharpApiWrapper\bin\Debug\merged\YouTrackSharpApiWrapper.dll'.
AssemblyResolver: Assembly 'YouTrackSharp' is referencing assembly 'Microsoft.CSharp'.
AssemblyResolver: Attempting referencing assembly's directory.
AssemblyResolver: Did not find assembly in referencing assembly's directory.
AssemblyResolver: Attempting input directory.
AssemblyResolver: Did not find assembly in input directory.
AssemblyResolver: Attempting user-supplied directories.
AssemblyResolver: No user-supplied directories.
AssemblyResolver: Attempting framework directory.
Can not find PDB file. Debug info will not be available for assembly 'Microsoft.CSharp'.
Resolved assembly reference 'Microsoft.CSharp' to 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\Microsoft.CSharp.dll'. (Used framework directory.)
An exception occurred during merging:
Unresolved assembly reference not allowed: CommandLine.
at System.Compiler.Ir2md.GetAssemblyRefIndex(AssemblyNode assembly)
at System.Compiler.Ir2md.GetTypeRefIndex(TypeNode type)
at System.Compiler.Ir2md.VisitReferencedType(TypeNode type)
at System.Compiler.Ir2md.GetMemberRefIndex(Member m)
at System.Compiler.Ir2md.GetMethodToken(Method m)
at System.Compiler.Ir2md.VisitConstruct(Construct cons)
at System.Compiler.Ir2md.VisitExpressionList(ExpressionList expressions)
at System.Compiler.Ir2md.VisitConstruct(Construct cons)
at System.Compiler.Ir2md.VisitAssignmentStatement(AssignmentStatement assignment)
at System.Compiler.Ir2md.VisitBlock(Block block)
at System.Compiler.Ir2md.VisitBlock(Block block)
at System.Compiler.Ir2md.VisitMethodBody(Method method)
at System.Compiler.Ir2md.VisitMethod(Method method)
at System.Compiler.Ir2md.VisitClass(Class Class)
at System.Compiler.Ir2md.VisitModule(Module module)
at System.Compiler.Ir2md.SetupMetadataWriter(String debugSymbolsLocation)
at System.Compiler.Ir2md.WritePE(Module module, String debugSymbolsLocation, BinaryWriter writer)
at System.Compiler.Writer.WritePE(String location, Boolean writeDebugSymbols, Module module, Boolean delaySign, String keyFileName, String keyName)
at System.Compiler.Writer.WritePE(CompilerParameters compilerParameters, Module module)
at ILMerging.ILMerge.Merge()
at ILMerging.ILMerge.Main(String[] args)
Sorry for a long post, but I've got not enough mana to insert more than 2 links, so had to paste log right in thread, and Markdown support here really sucks.

AssemblyResolver: Assembly 'YouTrackSharp' is referencing assembly 'CommandLine'.
It seems like some your components has a reference to CommandLine component, while the ILMerge parameter string doesn't contains that reference (as I can see from your log).
In attempt to resolve this issue try to specify /useFullPublicKeyForReferences parameter for ILMerge call. If it doesn't help, try to specify CommandLine library location at the end.

Related

MSBuild fails to copy dlls from relative path

Solution Directory contains ExtraDlls And Project Directories.
In the Project.csproj file we have references of dlls in the ExtraDlls with relative path. The Dlls in the ExtraDlls directory are always available.
<Reference Include="xyx, Version=7.3.0.0, Culture=neutral, PublicKeyToken=<sometoken>">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\ExtraDlls\A.dll</HintPath>
</Reference>
<Reference Include="xyz, Version=7.4.0.0, Culture=neutral, PublicKeyToken=<sometoken>">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\ExtraDlls\B.dll</HintPath>
<Private>True</Private>
</Reference>
Using below batch file to publish web project. But it fails with below mentioned details.
SET MSBUILD_PATH="C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\\Bin"
SET PUBLISH_DIRECTORY="C:\publish\ProjectA"
SET PROJECT_DIR="C:\SolutionDir\ProjectDir"
SET PROJECT="C:\SolutionDir\ProjectDir\Project.csproj"
cd %PROJECT_DIR%
%MSBUILD_PATH%\MSBuild.exe %PROJECT% /p:DeployOnBuild=True /p:DeployDefaultTarget=WebPublish /p:WebPublishMethod=FileSystem /p:DeleteExistingFiles=True /p:publishUrl=%PUBLISH_DIRECTORY%
PreBuildEvent:
copy "..\ExtraDlls\A.dll" "C:\SolutionDir\ProjectDir\bin\"
copy "..\ExtraDlls\B.dll" "C:\SolutionDir\ProjectDir\bin\"
The system cannot find the path specified.
The system cannot find the path specified.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(1328,5): error MSB3073: copy "..\ExtraDlls\A.dll" "C:\SolutionDir\ProjectDir\bin\" [C:\SolutionDir\ProjectDir\Project.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(1328,5): error MSB3073: copy "..\ExtraDlls\B.dll" "C:\SolutionDir\ProjectDir\bin\" [C:\SolutionDir\ProjectDir\Project.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(1328,5): error MSB3073: " exited with code 1.
Already tried with changing root directory in batch file. i.e. when root directory set with one containing MSBuild.exe, still getting the same issue.
Setting References updated with $(SolutionDir) didn't help.
e.g. $(SolutionDir)..\ExtraDlls\B.dll
There are many more references from ExtraDlls but showing error only for above two. Tried with changing relative path to absolute path in project.csproj file but still same error. So looks like it is being referenced from somewhere else.
In the project.csproj file, in the PreBuildEvent section the code is added if SolutionDir is not available then use ..\ (which visual studio can understand I guess) but MSBuild was throwing error or actually checking path starting with .\ which doesn't exist.
While using MSBuild.exe command pass a property /Property:SolutionDir="Path to solution file directory" which resolves all references and now getting all ExtraDlls copied correctly.
e.g.
MSBuild /Property:SolutionDir=%SOL_DIR_PATH% %PROJECT_SLN_PATH%\%PROJECT_DIRECTORY_NAME%\%PROJECT_NAME% /p:DeployOnBuild=True /p:DeployDefaultTarget=WebPublish /p:WebPublishMethod=FileSystem /p:DeleteExistingFiles=True /p:publishUrl=%PUBLISH_DIRECTORY%\%PROJECT_DIRECTORY_NAME%

Generate tlb from dll in same directory under another name

I want to make a type lib (tlb) having another name than dll:
c:\windows\Microsoft.NET\Framework\v4.0.30319\regasm.exe "c:\program files (x86)\sample_program\Library.dll" "c:\program files (x86)\sample_program\TypeLibname.tlb" /codebase
When executing this line in Powershell, no errors occur.
Microsoft .NET Framework Assembly Registration Utility 4.7.3056.0
für Microsoft .NET Framework, Version 4.7.3056.0
[...]
Types have been registered
So a tlb must have been generated. Though the tlb is put everywhere, but not in the desired directory "c:\program files (x86)\sample_program\"
Any idea ?
Thank you !
All the best,
Stephan
Just had to insert /tlb and change the expression into:
c:\windows\Microsoft.NET\Framework\v4.0.30319\regasm.exe "c:\program files (x86)\sample_program\Library.dll" /tlb:TypeLibname.tlb /codebase

MSBuild fails with an error in the "AL" task with error code AL1019

We are currently having problems while compiling a solution with MSBuild. The build fails randomly on the resource linking step inside the task "AL" which executes the "AL.exe" linker.
ALINK : error AL1019: Metadata failure while creating assembly -- The volume for a file has been externally altered so that the opened file is no longer valid.
The build log shows the following execution flow.
4>Target "GenerateSatelliteAssemblies" in file "C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets" from project "C:\source\MyProject.csproj" (target "CreateSatelliteAssemblies" depends on it):
4>Building target "GenerateSatelliteAssemblies" completely.
4>Output file "obj\Debug\de\MyProject.dll" does not exist.
4>Task "MakeDir"
4>Done executing task "MakeDir".
4>Task "AL"
4> C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\AL.exe /culture:de /out:obj\Debug\de\MyProject.resources.dll /template:obj\Debug\MyProject.dll /embed:obj\Debug\MyProject.SomeResource.de.resources
4> Microsoft (R) Assembly Linker version 14.0.0081.0
4> Copyright (C) Microsoft Corporation. All rights reserved.
4>
4>Done executing task "AL".
4>Done building target "GenerateSatelliteAssemblies" in project "MyProject.csproj".
4>Target "GenerateSatelliteAssemblies" in file "C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets" from project "C:\source\MyProject.csproj" (target "CreateSatelliteAssemblies" depends on it):
4>Building target "GenerateSatelliteAssemblies" completely.
4>Output file "obj\Debug\en\MyProject.resources.dll" does not exist.
4>Task "MakeDir"
4>Done executing task "MakeDir".
4>Task "AL"
4> C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\AL.exe /culture:en /out:obj\Debug\en\MyProject.resources.dll /template:obj\Debug\MyProject.dll /embed:obj\Debug\MyProject.SomeResource.en.resources
4> Microsoft (R) Assembly Linker version 14.0.0081.0
4> Copyright (C) Microsoft Corporation. All rights reserved.
4>
4>ALINK : error AL1019: Metadata failure while creating assembly -- The volume for a file has been externally altered so that the opened file is no longer valid.
4> The command exited with code 1.
4>Done executing task "AL" -- FAILED.
4>Done building target "GenerateSatelliteAssemblies" in project "MyProject.csproj" -- FAILED.
To me it is completely unclear what is meant by the error code AL1019. The MSDN error code listing didn't help either.

msbuild - UnitTestFramework reference could not be resolved

I'm trying to run msbuild in Jenkins.
When it reaches the UniTest-Project an error occures:
Project "C:\Program Files (x86)\Jenkins\jobs\***\workspace\***.sln" (1) is building "C:\Program Files (x86)\Jenkins\jobs\***\workspace\***.unitTests\***.unitTests.csproj" (4) on node 0 (default targets).
Project file contains ToolsVersion="4.0", which is not supported by this version of MSBuild. Treating the project as if it had ToolsVersion="3.5".
ResolveAssemblyReferences:
Primary reference "Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL".
Could not find dependent files. Could not load file or assembly 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets : warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
For SearchPath "{Registry:Software\Microsoft\.NetFramework,v4.0,AssemblyFoldersEx}".
Considered "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VSTSDB\Microsoft.VisualStudio.QualityTools.UnitTestFramework.exe", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VSTSDB\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\2.0\Runtime\v4.0\Microsoft.VisualStudio.QualityTools.UnitTestFramework.exe", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\2.0\Runtime\v4.0\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll", but it didn't exist.
Considered "C:\Program Files (x86)\MySQL\MySQL Connector Net 6.3.6\Assemblies\v2.0\Microsoft.VisualStudio.QualityTools.UnitTestFramework.exe", but it didn't exist.
Considered "C:\Program Files (x86)\MySQL\MySQL Connector Net 6.3.6\Assemblies\v2.0\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll", but it didn't exist.
Considered "C:\Program Files (x86)\MySQL\MySQL Connector Net 6.3.6\Assemblies\v4.0\Microsoft.VisualStudio.QualityTools.UnitTestFramework.exe", but it didn't exist.
Considered "C:\Program Files (x86)\MySQL\MySQL Connector Net 6.3.6\Assemblies\v4.0\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft.NET\Primary Interop Assemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.exe", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft.NET\Primary Interop Assemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.exe", but it didn't exist.
CalculatorServiceTest.cs(1,17): error CS0234: The type or namespace name 'VisualStudio' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
CalculatorServiceTest.cs(11,10): error CS0246: The type or namespace name 'TestMethod' could not be found (are you missing a using directive or an assembly reference?)
CalculatorServiceTest.cs(11,10): error CS0246: The type or namespace name 'TestMethodAttribute' could not be found (are you missing a using directive or an assembly reference?)
CalculatorServiceTest.cs(24,10): error CS0246: The type or namespace name 'TestMethod' could not be found (are you missing a using directive or an assembly reference?)
CalculatorServiceTest.cs(24,10): error CS0246: The type or namespace name 'TestMethodAttribute' could not be found (are you missing a using directive or an assembly reference?)
CalculatorServiceTest.cs(37,10): error CS0246: The type or namespace name 'TestMethod' could not be found (are you missing a using directive or an assembly reference?)
CalculatorServiceTest.cs(37,10): error CS0246: The type or namespace name 'TestMethodAttribute' could not be found (are you missing a using directive or an assembly reference?)
CalculatorServiceTest.cs(6,6): error CS0246: The type or namespace name 'TestClass' could not be found (are you missing a using directive or an assembly reference?)
CalculatorServiceTest.cs(6,6): error CS0246: The type or namespace name 'TestClassAttribute' could not be found (are you missing a using directive or an assembly reference?)
Done Building Project "C:\Program Files (x86)\Jenkins\jobs\***\workspace\***.unitTests\***.unitTests.csproj" (default targets) -- FAILED.
Done Building Project "C:\Program Files (x86)\Jenkins\jobs\***\workspace\***.sln" (default targets) -- FAILED.
Build FAILED.
Any suggestions what the problem could be? Running ms build from the command works for the solution and without any additional parameters when the project was compiles in VS bevor. After a clean solution the same errors occur. Must be some parameter or reference problem; Line two talks bout v4 and v3.5 problems; but i can't figure out how to solve this.
Greets
Error info directly shows that you use incorrect version of MSBuild
This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
Try to rebuild with MSBuild 4.0
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe *.sln /t:rebuild
OR/AND from VS2010 Command Line.
I had a similar problem which seemed to be caused by running Jenkins as a service under the SYSTEM account. Somehow cmd.exe was not referencing all the necessary environment variables to be able to find my NUnit assemblies.
If you're running Jenkins as a service, try setting it to run as your user account and see if that helps.
Im building from the default windows cmd using:
C:...\MSBuild.exe *.sln
The solution-projects are all 3.5; only the Unit-Test Project is 4.0 (as you can't change this)
I just mentioned, that building it that way works, when i build it first with VS and don't deleted (clean solution) the binaries. Never mind.
How do i have to use msbuild from cmd to build a *.sln including unittests?

disable or remove ASPNETCOMPILER warning CS1685

We are using msbuild to build our .NET solution.
Does anyone know how to get rid of these warnings at the end of the build?
(Build target) ->
ASPNETCOMPILER : warning CS1685: The predefined type 'Microsoft.CSharp.RuntimeBinder.Binder' is defined in multiple
assemblies in the global alias; using definition from 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framewo
rk.NETFramework\v4.0\Microsoft.CSharp.dll' [C:\Projects\Trunk\dev\source\UserInterface.metaproj]
ASPNETCOMPILER : warning CS1685: The predefined type 'Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags' is defined
in multiple assemblies in the global alias; using definition from 'c:\Program Files (x86)\Reference Assemblies\Micros
oft\Framework.NETFramework\v4.0\Microsoft.CSharp.dll' [C:\Projects\Trunk\dev\source\UserInterface.metaproj]
ASPNETCOMPILER : warning CS1685: The predefined type 'Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo' is defined
in multiple assemblies in the global alias; using definition from 'c:\Program Files
....
several pages of these warnings.
It is not recommend to disable warnings (they are here to warn you...). But if you really want to skip them you can add "nowarn=1695" to your command line. For example
MsBuild.exe UserInterface.metaproj /t:Build /p:Configuration=Release;nowarn=1695