[CSHARP-4214] Error in MSbuild publish of Web Project in .NET 4.8 Created: 16/Jun/22  Updated: 28/Oct/23  Resolved: 21/Jun/22

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 2.16.1

Type: Bug Priority: Minor - P4
Reporter: Gian Maria Ricci Assignee: Dmitry Lukyanov (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File 2022-06-16_10-20-51.png     PNG File 2022-06-16_10-26-12.png    

 Description   

Summary

After update driver from version 2.12.x to version 2.16, All continuous integration build that publish web projects fails with an error. Same error happens in local publish.

Driver version 2.16.0

How to Reproduce

We have a regular asp.net MVC 4.8 project that we publish with the commandline (publishing within Visual Studio works, only publish with msbuild via commandline fails)

"C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\msbuild.exe" "C:\dev\....\Jarvis.Web.csproj" /nologo /nr:false /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:OutDir=C:\dev\jarvis_deploy\cli /p:configuration="release"

This commandline will fail with the error

[error]src\packages\MSBuild.Microsoft.VisualStudio.Web.targets.14.0.0.3\tools\VSToolsPath\WebApplications\Microsoft.WebApplication.targets(187,5): Error MSB3094: "DestinationFiles" refers to 1 item(s), and "SourceFiles" refers to 2 item(s). They must have the same number of items.

Additional Background

The error seems to be in .target version that comes in nuget package of driver version 2.16.0, we solved temporarily the issue using a modified version of the package.



 Comments   
Comment by Githook User [ 21/Jun/22 ]

Author:

{'name': 'Gian Maria', 'email': 'ricci.gianmaria@gmail.com', 'username': 'alkampfergit'}

Message: CSHARP-4214: Fixed Build target. (#822)
Branch: v2.16.x
https://github.com/mongodb/mongo-csharp-driver/commit/fe1756a870353541bd3e40ab186e4122f2d1accc

Comment by Githook User [ 21/Jun/22 ]

Author:

{'name': 'Gian Maria', 'email': 'ricci.gianmaria@gmail.com', 'username': 'alkampfergit'}

Message: CSHARP-4214: Fixed Build target. (#822)
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/62fa8e2b6956a095f3515137f663c526d1394c45

Comment by Dmitry Lukyanov (Inactive) [ 20/Jun/22 ]

It looks like the issue you're seeing is related to msbuild preview version. I don't see it with released version: 17.0.0.52104, but changes itself looks harmless and correct too.

Comment by Gian Maria Ricci [ 17/Jun/22 ]

Thanks a lot, I've done a pull request with the modification that made our build starts working again.

 

https://github.com/mongodb/mongo-csharp-driver/pull/822

Comment by Dmitry Lukyanov (Inactive) [ 16/Jun/22 ]

Thanks alkampfer@nablasoft.com, your finding looks correct. We will look at this closely and come back to you.

Comment by Gian Maria Ricci [ 16/Jun/22 ]

As you can see in attached image, we found duplicated section in .target msbuild that is included in mongodb.core nuget package, simply removing all duplicated section evertythings starts working again.

 

 

Generated at Wed Feb 07 21:47:34 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.