【发布时间】:2022-11-03 02:54:26
【问题描述】:
我正在尝试发布一个需要 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
【问题讨论】:
标签: c# clickonce .net-6.0 visual-studio-2022