ClickOnce发布错误MSB3094:“ DestinationFiles”请参考2个项目,并“ SourceFiles”。指1个项目
我正在尝试发布需要具有IBM DB2的ClickOnce .NET 6应用程序。据我所知,DB2导致与GenerateManifest相关的错误,因此,作为解决的工作,我将GenerateManifest设置为False。但是,由于禁用了它,我遇到了一个新错误。我创建了一个非常简单的应用程序来尝试隔离导致此问题的原因,但是我仍然遇到了同样的问题。一切都很好,问题就在发布步骤中。
这是我正在运行的命令:
msbuild /t:publish /p:PublishProfile=ClickerTest\Properties\PublishProfiles\ClickOnceProfile.pubxml /property:Configuration=Release
这是要丢弃的错误:
Task "Copy" (TaskId:98)
Task Parameter:UseHardlinksIfPossible=False (TaskId:98)
Task Parameter:SkipUnchangedFiles=True (TaskId:98)
Task Parameter:
DestinationFiles=
bin\Release\net6.0-windows\app.publish\Application Files\ClickerTest_1_0_0_10\ClickerTest.dll.manifest
bin\Release\net6.0-windows\app.publish\Application Files\ClickerTest_1_0_0_10\ClickerTest.dll.deploy (TaskId:98)
Task Parameter:
SourceFiles=
bin\Release\net6.0-windows\ClickerTest.dll.manifest (TaskId:98)
Task Parameter:OverwriteReadOnlyFiles=False (TaskId:98)
Task Parameter:UseSymboliclinksIfPossible=False (TaskId:98)
"C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\ClickerTest.csproj" (publish target) (1) ->
(_CopyFilesToPublishFolder target) ->
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5868,5): error MSB3094:
"DestinationFiles" refers to 2 item(s), and "SourceFiles" refers to 1 item(s).
They must have the same number of items. [C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\ClickerTest.csproj]
这是CSPROJ文件:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Net.IBM.Data.Db2" Version="6.0.0.200" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
</Project>
这是ClickOnceProfile.pubxml
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<ApplicationRevision>10</ApplicationRevision>
<ApplicationVersion>1.0.0.*</ApplicationVersion>
<BootstrapperEnabled>True</BootstrapperEnabled>
<Configuration>Release</Configuration>
<CreateDesktopShortcut>True</CreateDesktopShortcut>
<CreateWebPageOnPublish>True</CreateWebPageOnPublish>
<GenerateManifests>False</GenerateManifests>
<Install>True</Install>
<InstallFrom>Web</InstallFrom>
<InstallUrl>http://example.com/ClickerTest/</InstallUrl>
<IsRevisionIncremented>True</IsRevisionIncremented>
<IsWebBootstrapper>True</IsWebBootstrapper>
<MapFileExtensions>True</MapFileExtensions>
<OpenBrowserOnPublish>False</OpenBrowserOnPublish>
<Platform>Any CPU</Platform>
<ProductName>ClickerTest</ProductName>
<PublishDir>bin\publish\</PublishDir>
<PublishUrl>bin\publish\</PublishUrl>
<PublisherName>Test</PublisherName>
<PublishProtocol>ClickOnce</PublishProtocol>
<PublishReadyToRun>False</PublishReadyToRun>
<PublishSingleFile>False</PublishSingleFile>
<SelfContained>False</SelfContained>
<SignatureAlgorithm>(none)</SignatureAlgorithm>
<SignManifests>False</SignManifests>
<TargetFramework>net6.0-windows</TargetFramework>
<UpdateEnabled>True</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateRequired>False</UpdateRequired>
<WebPageFileName>Publish.html</WebPageFileName>
</PropertyGroup>
</Project>
出版物的整个输出:
PS C:\Users\xxxxxx\source\repos\ClickerTest> msbuild ClickerTest\ClickerTest.csproj /t:publish /p:PublishProfile=ClickerTest\Properties\PublishProfiles\ClickOnceProfile.pubxml /property:Configuration=Release
Microsoft (R) Build Engine version 17.1.0+ae57d105c for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 4/25/2022 11:24:15 AM.
Project "C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\ClickerTest.csproj" on node 1 (publish target(s)).
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(2301,5): warning MSB3270: There was a mismatch between the processor architecture of the projec
t being built "MSIL" and the processor architecture of the reference "C:\Users\xxxxxx\.nuget\packages\net.ibm.data.db2\6.0.0.200\lib\net6.0\IBM.Data.Db2.dll", "AMD64". This mismatch may cause runtime failures. Please
consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references
with a processor architecture that matches the targeted processor architecture of your project. [C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\ClickerTest.csproj]
CoreResGen:
Processing resource file "Form1.resx" into "obj\Release\net6.0-windows\ClickerTest.Form1.resources".
GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
CoreGenerateAssemblyInfo:
Skipping target "CoreGenerateAssemblyInfo" because all output files are up-to-date with respect to the input files.
CoreCompile:
[Removed due to length requirements]
CompilerServer: server - server processed compilation - 2e54e130-9bea-485d-aa85-ca3dcbb8622f
_CopyOutOfDateSourceItemsToOutputDirectory:
Building target "_CopyOutOfDateSourceItemsToOutputDirectory" partially, because some output files are out of date with respect to their input files.
Copying file from "C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\obj\Release\net6.0-windows\apphost.exe" to "C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\bin\Release\net6.0-windows\ClickerTest.exe".
GenerateBuildRuntimeConfigurationFiles:
Skipping target "GenerateBuildRuntimeConfigurationFiles" because all output files are up-to-date with respect to the input files.
CopyFilesToOutputDirectory:
Copying file from "C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\obj\Release\net6.0-windows\ClickerTest.dll" to "C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\bin\Release\net6.0-windows\ClickerTest.dl
l".
ClickerTest -> C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\bin\Release\net6.0-windows\ClickerTest.dll
Copying file from "C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\obj\Release\net6.0-windows\ClickerTest.pdb" to "C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\bin\Release\net6.0-windows\ClickerTest.pd
b".
_CopyResolvedFilesToPublishPreserveNewest:
Building target "_CopyResolvedFilesToPublishPreserveNewest" partially, because some output files are out of date with respect to their input files.
Copying file from "C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\obj\Release\net6.0-windows\ClickerTest.dll" to "C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\bin\Release\net6.0-windows\app.publish\Cl
ickerTest.dll".
Copying file from "C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\bin\Release\net6.0-windows\ClickerTest.deps.json" to "C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\bin\Release\net6.0-windows\app.publ
ish\ClickerTest.deps.json".
Copying file from "C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\obj\Release\net6.0-windows\ClickerTest.pdb" to "C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\bin\Release\net6.0-windows\app.publish\Cl
ickerTest.pdb".
_CopyResolvedFilesToPublishAlways:
Copying file from "C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\obj\Release\net6.0-windows\apphost.exe" to "C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\bin\Release\net6.0-windows\app.publish\Clicke
rTest.exe".
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5868,5): error MSB3094: "DestinationFiles" refers to 2 item(s), and "SourceFiles" refers to 1 i
tem(s). They must have the same number of items. [C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\ClickerTest.csproj]
Done Building Project "C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\ClickerTest.csproj" (publish target(s)) -- FAILED.
Build FAILED.
"C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\ClickerTest.csproj" (publish target) (1) ->
(ResolveAssemblyReferences target) ->
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(2301,5): warning MSB3270: There was a mismatch between the processor architecture of the proj
ect being built "MSIL" and the processor architecture of the reference "C:\Users\xxxxxx\.nuget\packages\net.ibm.data.db2\6.0.0.200\lib\net6.0\IBM.Data.Db2.dll", "AMD64". This mismatch may cause runtime failures. Pleas
e consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on referenc
es with a processor architecture that matches the targeted processor architecture of your project. [C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\ClickerTest.csproj]
"C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\ClickerTest.csproj" (publish target) (1) ->
(_CopyFilesToPublishFolder target) ->
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5868,5): error MSB3094: "DestinationFiles" refers to 2 item(s), and "SourceFiles" refers to 1
item(s). They must have the same number of items. [C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\ClickerTest.csproj]
1 Warning(s)
1 Error(s)
Time Elapsed 00:00:02.11
I'm trying to publish a ClickOnce .NET 6 application that needs to have IBM DB2. From what I can tell, DB2 is causing an error related to the GenerateManifest, so as a work around for that I am setting GenerateManifest to false. With it disabled, though, I run into a new error. I created a very simple app to try to isolate what is causing this issue, but I'm still hitting the same problem. Everything builds fine, the issue is just with the publish step.
This is the command I'm running:
msbuild /t:publish /p:PublishProfile=ClickerTest\Properties\PublishProfiles\ClickOnceProfile.pubxml /property:Configuration=Release
This is the error that is being thrown:
Task "Copy" (TaskId:98)
Task Parameter:UseHardlinksIfPossible=False (TaskId:98)
Task Parameter:SkipUnchangedFiles=True (TaskId:98)
Task Parameter:
DestinationFiles=
bin\Release\net6.0-windows\app.publish\Application Files\ClickerTest_1_0_0_10\ClickerTest.dll.manifest
bin\Release\net6.0-windows\app.publish\Application Files\ClickerTest_1_0_0_10\ClickerTest.dll.deploy (TaskId:98)
Task Parameter:
SourceFiles=
bin\Release\net6.0-windows\ClickerTest.dll.manifest (TaskId:98)
Task Parameter:OverwriteReadOnlyFiles=False (TaskId:98)
Task Parameter:UseSymboliclinksIfPossible=False (TaskId:98)
"C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\ClickerTest.csproj" (publish target) (1) ->
(_CopyFilesToPublishFolder target) ->
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5868,5): error MSB3094:
"DestinationFiles" refers to 2 item(s), and "SourceFiles" refers to 1 item(s).
They must have the same number of items. [C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\ClickerTest.csproj]
This is the csproj file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Net.IBM.Data.Db2" Version="6.0.0.200" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
</Project>
And here is the ClickOnceProfile.pubxml
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<ApplicationRevision>10</ApplicationRevision>
<ApplicationVersion>1.0.0.*</ApplicationVersion>
<BootstrapperEnabled>True</BootstrapperEnabled>
<Configuration>Release</Configuration>
<CreateDesktopShortcut>True</CreateDesktopShortcut>
<CreateWebPageOnPublish>True</CreateWebPageOnPublish>
<GenerateManifests>False</GenerateManifests>
<Install>True</Install>
<InstallFrom>Web</InstallFrom>
<InstallUrl>http://example.com/ClickerTest/</InstallUrl>
<IsRevisionIncremented>True</IsRevisionIncremented>
<IsWebBootstrapper>True</IsWebBootstrapper>
<MapFileExtensions>True</MapFileExtensions>
<OpenBrowserOnPublish>False</OpenBrowserOnPublish>
<Platform>Any CPU</Platform>
<ProductName>ClickerTest</ProductName>
<PublishDir>bin\publish\</PublishDir>
<PublishUrl>bin\publish\</PublishUrl>
<PublisherName>Test</PublisherName>
<PublishProtocol>ClickOnce</PublishProtocol>
<PublishReadyToRun>False</PublishReadyToRun>
<PublishSingleFile>False</PublishSingleFile>
<SelfContained>False</SelfContained>
<SignatureAlgorithm>(none)</SignatureAlgorithm>
<SignManifests>False</SignManifests>
<TargetFramework>net6.0-windows</TargetFramework>
<UpdateEnabled>True</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateRequired>False</UpdateRequired>
<WebPageFileName>Publish.html</WebPageFileName>
</PropertyGroup>
</Project>
The entire output of the publish:
PS C:\Users\xxxxxx\source\repos\ClickerTest> msbuild ClickerTest\ClickerTest.csproj /t:publish /p:PublishProfile=ClickerTest\Properties\PublishProfiles\ClickOnceProfile.pubxml /property:Configuration=Release
Microsoft (R) Build Engine version 17.1.0+ae57d105c for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 4/25/2022 11:24:15 AM.
Project "C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\ClickerTest.csproj" on node 1 (publish target(s)).
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(2301,5): warning MSB3270: There was a mismatch between the processor architecture of the projec
t being built "MSIL" and the processor architecture of the reference "C:\Users\xxxxxx\.nuget\packages\net.ibm.data.db2\6.0.0.200\lib\net6.0\IBM.Data.Db2.dll", "AMD64". This mismatch may cause runtime failures. Please
consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references
with a processor architecture that matches the targeted processor architecture of your project. [C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\ClickerTest.csproj]
CoreResGen:
Processing resource file "Form1.resx" into "obj\Release\net6.0-windows\ClickerTest.Form1.resources".
GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
CoreGenerateAssemblyInfo:
Skipping target "CoreGenerateAssemblyInfo" because all output files are up-to-date with respect to the input files.
CoreCompile:
[Removed due to length requirements]
CompilerServer: server - server processed compilation - 2e54e130-9bea-485d-aa85-ca3dcbb8622f
_CopyOutOfDateSourceItemsToOutputDirectory:
Building target "_CopyOutOfDateSourceItemsToOutputDirectory" partially, because some output files are out of date with respect to their input files.
Copying file from "C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\obj\Release\net6.0-windows\apphost.exe" to "C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\bin\Release\net6.0-windows\ClickerTest.exe".
GenerateBuildRuntimeConfigurationFiles:
Skipping target "GenerateBuildRuntimeConfigurationFiles" because all output files are up-to-date with respect to the input files.
CopyFilesToOutputDirectory:
Copying file from "C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\obj\Release\net6.0-windows\ClickerTest.dll" to "C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\bin\Release\net6.0-windows\ClickerTest.dl
l".
ClickerTest -> C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\bin\Release\net6.0-windows\ClickerTest.dll
Copying file from "C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\obj\Release\net6.0-windows\ClickerTest.pdb" to "C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\bin\Release\net6.0-windows\ClickerTest.pd
b".
_CopyResolvedFilesToPublishPreserveNewest:
Building target "_CopyResolvedFilesToPublishPreserveNewest" partially, because some output files are out of date with respect to their input files.
Copying file from "C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\obj\Release\net6.0-windows\ClickerTest.dll" to "C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\bin\Release\net6.0-windows\app.publish\Cl
ickerTest.dll".
Copying file from "C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\bin\Release\net6.0-windows\ClickerTest.deps.json" to "C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\bin\Release\net6.0-windows\app.publ
ish\ClickerTest.deps.json".
Copying file from "C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\obj\Release\net6.0-windows\ClickerTest.pdb" to "C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\bin\Release\net6.0-windows\app.publish\Cl
ickerTest.pdb".
_CopyResolvedFilesToPublishAlways:
Copying file from "C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\obj\Release\net6.0-windows\apphost.exe" to "C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\bin\Release\net6.0-windows\app.publish\Clicke
rTest.exe".
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5868,5): error MSB3094: "DestinationFiles" refers to 2 item(s), and "SourceFiles" refers to 1 i
tem(s). They must have the same number of items. [C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\ClickerTest.csproj]
Done Building Project "C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\ClickerTest.csproj" (publish target(s)) -- FAILED.
Build FAILED.
"C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\ClickerTest.csproj" (publish target) (1) ->
(ResolveAssemblyReferences target) ->
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(2301,5): warning MSB3270: There was a mismatch between the processor architecture of the proj
ect being built "MSIL" and the processor architecture of the reference "C:\Users\xxxxxx\.nuget\packages\net.ibm.data.db2\6.0.0.200\lib\net6.0\IBM.Data.Db2.dll", "AMD64". This mismatch may cause runtime failures. Pleas
e consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on referenc
es with a processor architecture that matches the targeted processor architecture of your project. [C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\ClickerTest.csproj]
"C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\ClickerTest.csproj" (publish target) (1) ->
(_CopyFilesToPublishFolder target) ->
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5868,5): error MSB3094: "DestinationFiles" refers to 2 item(s), and "SourceFiles" refers to 1
item(s). They must have the same number of items. [C:\Users\xxxxxx\source\repos\ClickerTest\ClickerTest\ClickerTest.csproj]
1 Warning(s)
1 Error(s)
Time Elapsed 00:00:02.11
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我有一个类似的问题,在将以下属性添加到MSBUILD命令行时也解决了
I had a similar problem which was resolved when adding the following property to the MSBuild command line