I'm using VS2022 Setup project for a .Net Framework 4.8 winforms application. Locally on my PC everything runs fine, but running the project with TeamCity 2025.03 leads to a lot of warnings.
I build my setup project at TeamCity using command line:
"C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\devenv.com" Project.sln /build "Release" /project "SetupVS2022" /projectconfig Release
Warnings are:
------ Starting pre-build validation for project 'SetupVS2022' ------
10:05:59 WARNING: Unable to find dependency 'SYSTEM.DIAGNOSTICS.DIAGNOSTICSOURCE' (Signature='CC7B13FFCD2DDD51' Version='6.0.0.1') of assembly 'Microsoft.Identity.Client.dll'
10:05:59 WARNING: Unable to find dependency 'MICROSOFT.BCL.ASYNCINTERFACES' (Signature='CC7B13FFCD2DDD51' Version='6.0.0.0') of assembly 'Azure.Identity.dll'
10:05:59 WARNING: Unable to find dependency 'SYSTEM.DIAGNOSTICS.DIAGNOSTICSOURCE' (Signature='CC7B13FFCD2DDD51' Version='6.0.0.0') of assembly 'Azure.Identity.dll'
10:05:59 WARNING: Unable to find dependency 'SYSTEM.DIAGNOSTICS.DIAGNOSTICSOURCE' (Signature='CC7B13FFCD2DDD51' Version='6.0.0.0') of assembly 'Azure.Storage.Common.dll'
10:05:59 WARNING: Unable to find dependency 'MICROSOFT.BCL.ASYNCINTERFACES' (Signature='CC7B13FFCD2DDD51' Version='6.0.0.0') of assembly 'Azure.Storage.Common.dll'
10:05:59 WARNING: Unable to find dependency 'MICROSOFT.BCL.ASYNCINTERFACES' (Signature='CC7B13FFCD2DDD51' Version='6.0.0.0') of assembly 'System.ClientModel.dll'
10:05:59 WARNING: Unable to find dependency 'SYSTEM.DIAGNOSTICS.DIAGNOSTICSOURCE' (Signature='CC7B13FFCD2DDD51' Version='6.0.0.0') of assembly 'System.ClientModel.dll'
10:05:59 WARNING: Unable to find dependency 'SYSTEM.DIAGNOSTICS.DIAGNOSTICSOURCE' (Signature='CC7B13FFCD2DDD51' Version='6.0.0.2') of assembly 'Microsoft.IdentityModel.Tokens.dll'
10:06:02 WARNING: Unable to find dependency 'MICROSOFT.BCL.ASYNCINTERFACES' (Signature='CC7B13FFCD2DDD51' Version='6.0.0.0') of assembly 'Polly.Core.dll'
10:06:02 WARNING: Unable to find dependency 'SYSTEM.DIAGNOSTICS.DIAGNOSTICSOURCE' (Signature='CC7B13FFCD2DDD51' Version='6.0.0.1') of assembly 'Azure.Core.dll'
10:06:02 WARNING: Unable to find dependency 'MICROSOFT.BCL.ASYNCINTERFACES' (Signature='CC7B13FFCD2DDD51' Version='6.0.0.0') of assembly 'Azure.Core.dll'
10:06:02 WARNING: Unable to find dependency 'MICROSOFT.BCL.ASYNCINTERFACES' (Signature='CC7B13FFCD2DDD51' Version='6.0.0.0') of assembly 'Azure.Storage.Blobs.dll'
10:06:02 WARNING: Unable to find dependency 'SYSTEM.DIAGNOSTICS.DIAGNOSTICSOURCE' (Signature='CC7B13FFCD2DDD51' Version='6.0.0.0') of assembly 'Azure.Storage.Blobs.dll'
10:06:03 ------ Pre-build validation for project 'SetupVS2022' completed ------
10:06:03 ------ Erstellen gestartet: Projekt: SetupVS2022, Konfiguration: Release ------
10:06:03 Building file 'C:\TeamCity\buildAgent\work\6f13e5dd58f5b1e9\SetupVS2022\Release\SetupVS2022.msi'...
10:06:04 WARNING: 'System.Net.Http.dll' should be excluded because its source file 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Net.Http\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Net.Http.dll' is under Windows System File Protection.
10:06:05 WARNING: 'System.IO.Compression.dll' should be excluded because its source file 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.IO.Compression\v4.0_4.0.0.0__b77a5c561934e089\System.IO.Compression.dll' is under Windows System File Protection.
10:06:20 WARNING: Two or more objects have the same target location ('[targetdir]\system.net.http.dll')
10:06:20 WARNING: Two or more objects have the same target location ('[targetdir]\system.net.http.dll')
10:06:20 WARNING: Two or more objects have the same target location ('[targetdir]\system.io.compression.dll')
10:06:20 WARNING: Two or more objects have the same target location ('[targetdir]\system.io.compression.dll')
10:06:20 WARNING: Two or more objects have the same target location ('[targetdir]\microsoft.bcl.asyncinterfaces.dll')
10:06:20 WARNING: Two or more objects have the same target location ('[targetdir]\microsoft.bcl.asyncinterfaces.dll')
There is already an exisiting post with that problem here, but that does not solve my problem.
Dlls SYSTEM.DIAGNOSTICS.DIAGNOSTICSOURCE and MICROSOFT.BCL.ASYNCINTERFACES are not part of my original project dependencies in the main project. The setup project detects Microsoft.Bcl.AsyncInterfaces v9.0.0.2 and System.Diagnostics.DiagnosticSource v9.0.0.2 as detected dependencies . But the warnings are related to versions 6.0.0.[0,1,2]. Should I just manually add these to the Application Folder or is there a chance to prevent these warning? What happens if I don't fix the warning?
To get rid off the warning
WARNING: 'System.IO.Compression.dll' should be excluded because its source file
I excluded the dll from the detected dependencies in the setup project. After checking in the vdproj file it leads again to the same error.
[EDIT 1]
Adding SYSTEM.DIAGNOSTICS.DIAGNOSTICSOURCE 6.0.0.1 to the Application Folder does not change anything. The warning persists.
[EDIT 2]
I added the libraries manually into app.config assemblyBinding which resolved the WARNING: unable to find dependency.... I have no clue why this was missing...
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.2" newVersion="9.0.0.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.2" newVersion="9.0.0.2" />
</dependentAssembly>```
I still have the warnings:
```WARNING: 'System.IO.Compression.dll' should be excluded because its source file 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.IO.Compression\v4.0_4.0.0.0__b77a5c561934e089\System.IO.Compression.dll' is under Windows System File Protection.
10:06:20 WARNING: Two or more objects have the same target location ('[targetdir]\system.net.http.dll')
10:06:20 ```