编辑#1启动
为了复制这一点:
Windows Application Packaging Project (按照在Visual中为MSIX打包设置桌面应用程序中提到的步骤)编辑#1端
我正在将WPF .net框架应用程序转换为.net内核3.1。这个应用程序是一个“内部”工具,我们一直使用ClickOnce将创建设置放置在共享的UNC路径上。这么简单..。
我现在已经用.Net核心重新编写了它,并且需要部署它。发现"ClickOnce“不再可用,我知道我必须沿着"MSIX”路线前进。文件看起来应该很简单,但我想我遗漏了一些东西.
1-我不得不将我的开发人员设置从“侧栏”更改为"Developer Mode“2--它在我的机器上构建得很好,但是在Azure DevOps fails 3上--我如何实际部署它.?
让我们依次看一遍。
1 -侧栏=>开发人员模式发布
我将一个新的Windows应用程序打包项目添加到我的解决方案中,为目标版本和最低版本选择WindowsVersion1909,并将我的WPF应用程序设置为入口点。我试图运行这一点,它迫使我从“侧栏”改为“开发模式”。
这只会影响我作为developer....if,所以,这很好。我怀疑最终的最终用户会想要这样做。
2 - Azure DevOps构建管道失败
在本地,它编译得很好,甚至在发布模式下,我将所有警告设置为错误,并运行FxCop。把它推到Azure,上面写着:
errorC:\Program Files\dotnet\sdk\3.1.201\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(234,5):Error NETSDK1047: Assets 'd:\a\1\s\MyApp\MyApp\obj\project.assets.json‘没有针对“.NETCoreApp,Version=v3.1/win-x86”的目标。 确保还原已经运行,并且在项目的TargetFrameworks中包含了'netcoreapp3.1‘。 您还可能需要在项目的RuntimeIdentifiers中包含'win-x86‘。
好吧
<TargetFramework>netcoreapp3.1</TargetFramework>。<TargetFramework>netcoreapp3.1</TargetFramework>下面添加了<RuntimeIdentifiers>win-x64;win-x86</RuntimeIdentifiers> (我应该更具体地使用win10-x64;win10-x86吗?)不管是哪种方式,这都失败了,但消息略有不同:
正在构建的项目的处理器体系结构与引用“我的dll路径”"x86“的处理器体系结构不匹配。这种不匹配可能导致运行时失败。请考虑通过Configuration更改项目的目标处理器体系结构,以便在项目和引用之间对处理器体系结构进行调整,或者使用与项目目标处理器体系结构相匹配的处理器体系结构来依赖引用。
3 -我如何实际部署它?
在MSIX:在Windows上部署桌面应用程序的现代方法中,它声明:
要生成实际的MSIX包,在Visual中的下面有一个向导。
我的机器上没有.我甚至还安装了Visual工作负载“通用Windows平台开发”。我可以在构建menu...but下面看到一个“部署”,这是it....where,我是否放置了UNC路径?
我想我错过了一些很基本的东西..。
我的CSPROJ的相关部分是
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RuntimeIdentifiers>win-x64;win-x86</RuntimeIdentifiers>
<UseWPF>true</UseWPF>
</PropertyGroup>一揽子项目是:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '15.0'">
<VisualStudioVersion>15.0</VisualStudioVersion>
</PropertyGroup>
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x86">
<Configuration>Debug</Configuration>
<Platform>x86</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x86">
<Configuration>Release</Configuration>
<Platform>x86</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM">
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|ARM64">
<Configuration>Debug</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM64">
<Configuration>Release</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|AnyCPU">
<Configuration>Debug</Configuration>
<Platform>AnyCPU</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|AnyCPU">
<Configuration>Release</Configuration>
<Platform>AnyCPU</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup>
<WapProjPath Condition="'$(WapProjPath)'==''">$(MSBuildExtensionsPath)\Microsoft\DesktopBridge\</WapProjPath>
</PropertyGroup>
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.props" />
<PropertyGroup>
<ProjectGuid>08b169a2-6461-440b-afa1-ca35c7d98aa7</ProjectGuid>
<TargetPlatformVersion>10.0.18362.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.18362.0</TargetPlatformMinVersion>
<DefaultLanguage>en-US</DefaultLanguage>
<AppxPackageSigningEnabled>True</AppxPackageSigningEnabled>
<EntryPointProjectUniqueName>..\MyApp\MyApp.csproj</EntryPointProjectUniqueName>
<PackageCertificateThumbprint>01C08F1E21D5624A484DB362BE4F056504B825CC</PackageCertificateThumbprint>
</PropertyGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
</ItemGroup>
<ItemGroup>
<Content Include="Images\SplashScreen.scale-200.png" />
<Content Include="Images\LockScreenLogo.scale-200.png" />
<Content Include="Images\Square150x150Logo.scale-200.png" />
<Content Include="Images\Square44x44Logo.scale-200.png" />
<Content Include="Images\Square44x44Logo.targetsize-24_altform-unplated.png" />
<Content Include="Images\StoreLogo.png" />
<Content Include="Images\Wide310x150Logo.scale-200.png" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MyApp\MyApp.csproj">
<SkipGetTargetFrameworkProperties>True</SkipGetTargetFrameworkProperties>
</ProjectReference>
</ItemGroup>
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.targets" />
</Project>(我能/应该删除对“调试”和"ARM“的引用吗?)
最明显的是
<?xml version="1.0" encoding="utf-8"?>
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
IgnorableNamespaces="uap rescap">
<Identity
Name="46aebba6-d403-4412-89c0-05279b36e54e"
Publisher="CN=MyCompany"
Version="2020.5.0.0" />
<Properties>
<DisplayName>MyApp</DisplayName>
<PublisherDisplayName>MyCompany</PublisherDisplayName>
<Logo>Images\StoreLogo.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.14393.0" MaxVersionTested="10.0.14393.0" />
</Dependencies>
<Resources>
<Resource Language="x-generate"/>
</Resources>
<Applications>
<Application Id="App"
Executable="$targetnametoken$.exe"
EntryPoint="$targetentrypoint$">
<uap:VisualElements
DisplayName="MyApp.Package"
Description="MyApp.Package"
BackgroundColor="transparent"
Square150x150Logo="Images\Square150x150Logo.png"
Square44x44Logo="Images\Square44x44Logo.png">
<uap:DefaultTile Wide310x150Logo="Images\Wide310x150Logo.png" />
<uap:SplashScreen Image="Images\SplashScreen.png" />
</uap:VisualElements>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
<rescap:Capability Name="runFullTrust" />
</Capabilities>
</Package>谢谢!
发布于 2021-05-21 06:35:35
请在.wapproj项目文件中添加,
<PropertyGroup>
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
None
</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
</PropertyGroup>https://stackoverflow.com/questions/61826678
复制相似问题