将 xml 转换应用于 app.manifest
Applying xml transformation to app.manifest
我刚刚继承了一个 C# 应用程序。它目前在 app.manifest 中有一个条目来启用 UAC
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
每次我在 visual studio 中进行调试构建时,我都会得到提示 "This task requires the application to have elevated permissions"。 (我有一个管理员帐户,但我在开发时没有使用它登录。)
有没有办法对其应用 xml 转换(如 web.configs)或为发布模式制作 app.manifest?
使用 SlowCheetah NuGet 包和随附的扩展,您将在所有 xml 文件上获得与 web.config 相同的行为。
确保 install/activate NuGet 包和 Visual Studio 扩展。此外,NuGet 中有许多 Slow Cheetah 版本 - 我建议使用 Microsoft 发布的最新版本 - Microsoft.VisualStudio.SlowCheetah.
阅读更多相关信息:https://github.com/Microsoft/slow-cheetah
编辑:为了让我的 Sharepoint 加载项项目的 App.Manifest.xml 转换正常工作,我费了好大劲。事实证明,当您使用 "Add transform" 时为您创建的文件缺少一些细节,如果不包含这些细节将导致转换失败(没有结果)。这是我得出的结论:
<!-- Mandatory block in AppManifest transform files: -->
<App xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform" xmlns="http://schemas.microsoft.com/sharepoint/2012/app/manifest"
Name="Not transformed"
ProductID="{12345678-0000-0000-0000-123456789123}"
Version="0.0.0.0"
SharePointMinVersion="0.0.0.0"
>
<Properties>
<Title>Not transformed</Title>
<StartPage>Not transformed</StartPage>
</Properties>
<AppPrincipal>
<RemoteWebApplication ClientId="*" />
</AppPrincipal>
</App>
<!--
This block as it is written will cause no transformation whatsoever, but all elements above must be present for any transformation to be applied.
To transform an entire element along with its text content, add the attribute xdt:Transform="Replace" to the element. This will also replace all
child elements.
-->
希望对您有所帮助!
我刚刚继承了一个 C# 应用程序。它目前在 app.manifest 中有一个条目来启用 UAC
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
每次我在 visual studio 中进行调试构建时,我都会得到提示 "This task requires the application to have elevated permissions"。 (我有一个管理员帐户,但我在开发时没有使用它登录。)
有没有办法对其应用 xml 转换(如 web.configs)或为发布模式制作 app.manifest?
使用 SlowCheetah NuGet 包和随附的扩展,您将在所有 xml 文件上获得与 web.config 相同的行为。
确保 install/activate NuGet 包和 Visual Studio 扩展。此外,NuGet 中有许多 Slow Cheetah 版本 - 我建议使用 Microsoft 发布的最新版本 - Microsoft.VisualStudio.SlowCheetah.
阅读更多相关信息:https://github.com/Microsoft/slow-cheetah
编辑:为了让我的 Sharepoint 加载项项目的 App.Manifest.xml 转换正常工作,我费了好大劲。事实证明,当您使用 "Add transform" 时为您创建的文件缺少一些细节,如果不包含这些细节将导致转换失败(没有结果)。这是我得出的结论:
<!-- Mandatory block in AppManifest transform files: -->
<App xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform" xmlns="http://schemas.microsoft.com/sharepoint/2012/app/manifest"
Name="Not transformed"
ProductID="{12345678-0000-0000-0000-123456789123}"
Version="0.0.0.0"
SharePointMinVersion="0.0.0.0"
>
<Properties>
<Title>Not transformed</Title>
<StartPage>Not transformed</StartPage>
</Properties>
<AppPrincipal>
<RemoteWebApplication ClientId="*" />
</AppPrincipal>
</App>
<!--
This block as it is written will cause no transformation whatsoever, but all elements above must be present for any transformation to be applied.
To transform an entire element along with its text content, add the attribute xdt:Transform="Replace" to the element. This will also replace all
child elements.
-->
希望对您有所帮助!