ILMERGE error while merging multiple dlls into plugin project - ilmerge

mkdir "$(TargetDir)Merged"
I was able to merge upto Newtonsoft.Json.dll and buld successfully, but as we add Agero.Core.Checker.dll we get the exited with code 1

Related

ILMerge merging happening successfully using .NET Framework but final execution is throwing runtime exception

Want to merge several .NET Framework DLL's into a single exe (console application). Merging is successful through command line using ilmerge but when finally executing the exe it is throwing exception.
Also when I build the project in Visual Studio (.NET Framework: 4.7.1) and opening the exe file from "Bin\Debug" folder, it is working properly.
Command Used in PowerShell ISE (Automatically taking targetplatform v4):
"$($ILMERGE_PATH)\ILMerge.exe /target:exe /allowDup /log:""$($path)\log.txt"" /out:Releases$APP_NAME $("$path\$mainProjectName\bin\$ILMERGE_BUILD\$mainProjectName").exe $getAllFilesRef"
$getAllFilesRef: List of all DLL's which needs to be included in exe.
Error shown after ILMerging and opening the exe on the same computer.Also while checking the logs there is no error seen and at last ILMerge said Done:

XAML MSBuild task XamlMarkupCompilePass1 fails in parallel MSBuild and throws error Access denied

We have several projects containing XAML UI and XAML workflow files. Since we enabled execution of MSBuild in parallel, with the flag /m the builds, from time to time we get an exception in the MSBuild task XamlMarkupCompilePass1
##[error]C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Xaml.targets(193,5): Error XC1000: XC1020: Build error occurred in the XAML MSBuild task: 'Could not load file or assembly 'file:///C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\Facades\System.Threading.ThreadPool.dll' or one of its dependencies. Access is denied.
This is just an example, it is also happening sometimes on NuGet packages and not only .NET framework assemblies.
What is our setup: We have build servers and on each we have at least 2 build agents.
What did we try out already:
Turning off build agents to have only one per server, still running MSBuild with /m --> failed with Access denied
Run msbuild without /m --> was successful, but not a solution because of too long running build
Try to use a hidden flag for MSBuild, to retry on access denied MSBUILDALWAYSRETRY --> this is only used for Copy MSBuild task and not the XAML msbuild task
Question: Is there a way to affect the MSBuild task XamlMarkupCompilePass1 somehow? or is there another solution than turning off parallel execution of MSBuild? I guess there is also a possibility that XamlMarkupCompilePass2 could fail as well but didn't see that.

Build fail in msbuild source code(https://github.com/Microsoft/msbuild)

I have cloned MSBuild source code from (https://github.com/Microsoft/msbuild) and followed below steps to build the project.
Building MSBuild with Visual Studio 2017
Install Visual Studio 2017.
Clone the source code
Build the code using the cibuild.cmd script
Open src/MSBuild.sln solution and build in Visual Studio 2017
But build is getting failed with following errors when we try to build from VS 2017
The imported project "C:\msbuildgit\msbuild\packages\Nerdbank.GitVersioning\1.5.46\build\dotnet\Nerdbank.GitVersioning.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk. Microsoft.Build.CommandLine.UnitTests
The imported project "C:\msbuildgit\msbuild\packages\Nerdbank.GitVersioning\1.5.46\build\dotnet\Nerdbank.GitVersioning.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk. Microsoft.Build.Engine.OM.UnitTests
and also following projects are not getting loaded
Microsoft.Build ,Microsoft.Build.Framework,Microsoft.Build.Tasks
Microsoft.Build.Utilities,MSBuildTaskHost
getting following error , when we try to reload above projects
C:\msbuildgit\msbuild\src\Build\Microsoft.Build.csproj : error : The imported project "C:\msbuildgit\msbuild\packages\Nerdbank.GitVersioning\1.5.46\build\dotnet\Nerdbank.GitVersioning.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk. C:\msbuildgit\msbuild\src\dir.targets
following options have been tried and both were getting failed
tried restoring nuget packages
tried installing Nerdbank.GitVersioning nuget(https://www.nuget.org/packages/Nerdbank.GitVersioning/)
Please note that cibuild.cmd script has been already executed
Please help us on this.
Issue has been resolve by following below steps ,Jeff Kluge helped on this after raising this issue in GitHub(https://github.com/Microsoft/msbuild/issues/1947)
Open Developer Command Prompt for VS 2017
Run cd /d C:\msbuildgit\msbuild
Run git clean -xfd to clean the enlistment
Run cibuild.cmd --build-only to build the source code

How to make MSBuild CoreClean before copy step?

I have a Class Library Project which contains t4 templates that execute on build. The output .sql files are set to Content of the .csproj and should be copied on build to the output folder.
I have the following configuration setup on my TeamCity Build Box using MSBuild:
Command line parameters:
/p:OutDir=C:\output\DBMigration
/p:Configuration=Release
/p:DebugSymbols=false
/p:DebugType=None
/p:DeleteExistingFiles=true
/t:rebuild
/verbosity:n
The output of this is that the files are copied to the outputdir but are deleted in the CoreClean step of the rebuild.
To get around this I can run a Build instead of a rebuild, (ie. /t:build).
This will skip the CoreClean step, but why is the CoreClean called on the output dir after the Copy process has taken place? Should the Delete action not be before the Copy?
And why do I only need to do this step for ClassLibrary type projects, web/windows applications do not seem to have this problem with the rebuild.
Also it appears from the build log that the output directory is never cleaned by /p:DeleteExistingFiles=true.
I could do a hack and force a powershell script to run to clean the directory before attempting to build, but there must be a supported MSbuild parameter to do this in the absence of the rebuild preforming correctly?

NAnt + MSBuild (4.0) == MSBuild launch failure w/directory not found error

Ive got CC.Net and NAnt (and MSBuild) running on a new VM-based build server (Win7-64 Pro).
CC.Net can call MSBuild just fine - but I run into problems there when dealing with project-scope builds. The conditionals just dont have what I need. Not even close.
So I decide to deal with those conditions by calling MSBuild with NAnt, which fails every time. When I run the nant script from the command prompt, I get this:
[loadtasks] Failure scanning "C:\nant\bin\extensions\common\2.0\Collection
Gen.dll" for extensions. Could not load file or assembly 'Microsoft.VSDesigner,
Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of
its dependencies. The system cannot find the file specified.
Buildfile: file:///c:/c7/projects/dyndata/dyndata.build
Target framework: Microsoft .NET Framework 4.0
Target(s) specified: build
build:
[loadtasks] Scanning directory "c:\nantcontrib\bin\lib" for extension assemblies
.
[echo] Building DynData v7.0.7
BUILD FAILED
c:\c7\projects\dyndata\dyndata.build(24,12):
Failed to start MSBuild.
c:\c7\projects\dyndata\dyndata.build(24,12):
External Program Failed: C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbui
ld.exe (return code was 1)
Total time: 0.4 seconds.
c:\c7\projects\dyndata\dyndata.build(24,12):
Failed to start MSBuild.
c:\c7\projects\dyndata\dyndata.build(24,12):
'C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe' failed to start.
The directory name is invalid
The Designer assembly is present on this machine, which has VS2010 Pro installed on it.
The build folder is correct.
The framework folder is correct.
Umpteen searches for nant/msbuild and this message have yielded nothing substantive.
These items have been tried and failed to change the results:
Nant msbuild task with .net 4.0 rc
.NET projects build automation with NAnt/MSBuild + SVN (tho I am using Vault)
I tried to build the nant code so I could debug the problem via VS2010's debugger but the source project is an unworkable mess and wont even begin to build.
Ideas are welcome:)
I think the first error about Microsoft.VSDesigner is just a warning - not a failure. On my developer box and build server I have VS2005 and VS2010 Pro installed and I do not have Microsoft.VSDesigner version 7 installed. I have version 8 and 9 installed but not 7.
It looks like the "build" target is running in nant and then then it fails. You are loading the tasks from nantcontrib then trying to start msbuild. How are you starting msbuild? Could you post the part of the nant file that starts it? What version of nant are you using? Does running nant with -v and -debug+ flags show anything helpful?