msbuild 相关问题

Microsoft Build Engine,也称为MSBuild,是托管代码的构建平台,是.NET Framework的一部分。


winexe

我创建了一个最小项目来测试:: ClickOnce 使用Visual Studio 2022的GUI向导生成了My<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>WinExe</OutputType> <TargetFramework>net8.0-windows</TargetFramework> <Nullable>enable</Nullable> <ImplicitUsings>enable</ImplicitUsings> <LangVersion>latest</LangVersion> <UseWPF>true</UseWPF> </PropertyGroup> </Project> 。 如果我使用GUI发布(即,在项目上右键单击右键单击,然后“发布”)一切都按预期工作。 not,从克利 ClickOnceProfile.pubxml 在以下错误中解释: ERROR MSB4803:MSBUILD的.NET CORE版本不支持任务“ GenerateBootStrapper”。请使用MSBUILD的.NET框架版本。有关更多详细信息 我尝试在我的dotnet publish -p:PublishProfile=ClickOnceProfile 文件中添加<UseMSBuildRuntime>Framework</UseMSBuildRuntime>,但是错误仍然存在。 任何帮助? 我经历了同样的问题,同一错误消息。 然后,然后找到此注释Https://github.com/dotnet/sdk/issues/33718#issuecomment-1615229332指出“ ClickOnce Publish不支持Dotnet Publish。 我尝试了MSBUILD的多种变体,我还试图在Azure DevOps Pipeline中工作。 我最终在本地CMD提示中工作的是: *csproj this this ther ther ther在我的clickonceprofile.pubxml中指定的PublishDir文件夹,其中包含预期文件,即设置文件,application usivest,laundinger.exe和application files文件夹。

回答 0 投票 0

打字稿MSBuild在Visual Studio2022

目前,在Visual Studio 2022中,当使用Microsoft.typescript.msbuild保存打字稿文件时,我将打字稿自动转移到JavaScript中。 但是,我现在有一个

回答 1 投票 0


启动powershell脚本在vs2022

我有一个电源弹脚本,并将其放在vs 2022的前构建领域中 不起作用。但是它在2022年之外工作。 所以我尝试了一个测试代码 - 将其放入文件text.ps1中 #test-script 写入 -

回答 1 投票 0

MMSBUILD评估顺序

文件所述: Directory.build.props文件由Microsoft.Common.Props导入,因此在项目文件中定义的属性可用。 因此,这意味着可怕的...

回答 1 投票 0


可以将MSBuild的WriteCodeFragment与非弦乐参数一起使用? 我正在尝试使用MSBUILD中的WriteCodeFragment来编写“汇编属性”属性环境PermissionAttribute。 这采用类型SecurityAction的参数,这不是字符串。 WriteCodeFrag ...

。 这采用类型SecurityAction的参数,这不是字符串。 WriteCodeFragment的汇编属性似乎仅支持字符串。 以任何方式编写EnvironmentPermissionAttribute? 我知道此标签已在.NET 4中弃用,但我正在移植一些旧代码。

回答 2 投票 0


为什么我的前出版PowerShell脚本两次执行?

我与AOT一起使用大风WASM PWA。我创建了一个PowerShell脚本,该脚本想在发布构建之前执行。所以,我添加了 <Target Name="PrePublishScript" BeforeTargets="PrepareForPublish"> <Exec Command="powershell -ExecutionPolicy Bypass -File script.ps1" /> </Target> 在项目文件中。 该代码有效,但我的脚本执行两次: 原始化构建过程 run脚本 “优化大小的组件。此过程可能需要一段时间。” run脚本(不想要)。 Brotli一些文件 aoting i通过msbuild WRCT.csproj /t:Publish /p:Configuration=Release /v:diag > build.log创建了一个日志文件。它的内容包含两次。这可能是执行执行的原因吗? __CorePublishTargets= prepareforpublish;ComputeAndcopyFileStopublishDirectory; ;PublishItemsoutputgroup; 和 __publishNobuildAltertaltivedSon= buildOnlySettings; _preventProjectReferences frombuilding; 分辨率; PreparEresourCenames; computeInterMediateSateLiteassemblies; computeembeddedapphostpath; ; prepareforpublish; ComputeAndcopyFileStopublishDirectory; ; PublishItemsoutputgroup; Maybe,我可以在日志文件中找到一个PrepareForPublish,但其大小为315 MB ... 我如何避免执行脚本两次? 还是有其他方法可以在发布构建之前自动执行脚本? eDit 在我的日志文件中,我找到了目标`_ _gatherblazorfilestopublish`,并将其用作`beforetargets =“ _ gathingblecthblazorfilestopublish”>`。这起作用了,现在我的脚本只执行一次,但是说实话,我不知道自己在做什么。可以使用此目标吗? 问题中的编辑提供了一个可能的解决方案,但是它的缺点。具有领先下划线(_)的目标是内部目标,可以更改。因此,今天BeforeTargets="Whatever"工作,但可以重命名。这是一个更可靠的可能性: _GatherBlazorFilesToPublish 构建过程是发生的第一件事。高于第一个目标现在定义变量<Target Name="ExecuteScriptCondition" BeforeTargets="Build"> <PropertyGroup> <ExecuteScript>true</ExecuteScript> </PropertyGroup> </Target> <Target Name="PrePublishScript" BeforeTargets="BeforePublish" Condition="'$(ExecuteScript)' == 'true'"> <PropertyGroup> <ExecuteScript>false</ExecuteScript> </PropertyGroup> <Exec Command="powershell -ExecutionPolicy Bypass -File script.ps1" /> </Target> 并将其设置为“ true”。现在是时候将plublish的时间设置为false并执行脚本。第二次以前plublishExecuteScript评估false,脚本未执行。 我发布的第一个答案,一定要工作,所以我将其保存在下面。但是我找到了一个较小的解决方案: ExecuteScript 现在,该脚本是执行Condition="'$(ExecuteScript)' == 'true'"<Target Name="PrePublishScript" BeforeTargets="BeforeBuild" Condition="'$(IsPublishing)' == 'true'"> <Exec Command="powershell -ExecutionPolicy Bypass -File script.ps1" /> </Target> ,但仅当变量BeforeBuild是“ true”时才执行。 IsPublishing还确保这是第一件事。就我而言,这很重要,因为脚本更改了一些JS文件,并且在离线模式下使用该应用程序时,完整性检查失败了。

回答 1 投票 0

Visual Studio 2008锁定自定义MSBUILD任务组件

级,并在项目中使用它。视觉工作室坚持MSBUILD任务DLL而不是放手的行为使我受阻。

回答 2 投票 0

回答 1 投票 0

如何防止Visual Studio / Rider的软件包经理调整某些.csproj<PackageReference>元素

<PackageReference Include="Foo.Bar" Version="1.2.4" Condition=" '$(IsForSimulator)' == 'false' "> <PackageReference Include="Foo.Bar" Version="1.2.3-force-dud" Condition=" '$(IsForSimulator)' == 'true' "> <NoWarn>$(NoWarn);NU1605</NoWarn> </PackageReference> 如果我使用Nuget Package Manager GUI更新Nuget软件包,则将更新两个元素! 我希望第二个保持不受影响。这可能吗? 我想出了一种有效的方法: inside .csproj仅保留此位 <!-- the condition must be on the item-group not on the package-ref! --> <ItemGroup Condition=" '$(IsForSimulator)' == 'false' "> <PackageReference Include="Foo.Bar" Version="1.2.4"> </ItemGroup> 现在创建一个称为“ nugettweaksforsimulators.targets”的单独文件,然后将其放入: <?xml version="1.0" encoding="utf-8"?> <!-- the package manager cannot affect these nuget-entries because they're livign on this side-file! --> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Condition=" '$(IsForSimulator)' == 'true' "> <PackageReference Include="Foo.Bar" Version="1.2.3-force-dud"> <NoWarn>$(NoWarn);NU1605</NoWarn> </PackageReference> </ItemGroup> </Project> 包括“ Nugettweaksforsimulators.targets”的“ nugettweaksforsimults”: <Import Project="NugetTweaksForSimulators.targets"/> 得出!

回答 1 投票 0

如何防止VisualStudio/Rider的软件包管理器调整某些.csproj<PackageReference>元素

<PackageReference Include="Foo.Bar" Version="1.2.4" Condition=" '$(IsForSimulator)' == 'false' "> <PackageReference Include="Foo.Bar" Version="1.2.3-force-dud" Condition=" '$(IsForSimulator)' == 'true' "> <NoWarn>$(NoWarn);NU1605</NoWarn> </PackageReference> 如果我使用Nuget Package Manager GUI更新Nuget软件包,则将更新两个元素! 我希望第二个保持不受影响。有可能吗? 我想出了一种有效的方法: inside .csproj仅保留此位 <!-- the condition must be on the item-group not on the package-ref! --> <ItemGroup Condition=" '$(IsForSimulator)' == 'false' "> <PackageReference Include="Foo.Bar" Version="1.2.4"> </ItemGroup> 现在创建一个称为“ nugettweaksforsimulators.targets”的单独文件,然后将其放入: <?xml version="1.0" encoding="utf-8"?> <!-- the package manager cannot affect these nuget-entries because they're livign on this side-file! --> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Condition=" '$(IsForSimulator)' == 'true' "> <PackageReference Include="Foo.Bar" Version="1.2.3-force-dud" Condition=" '$(IsForSimulator)' == 'true' "> <NoWarn>$(NoWarn);NU1605</NoWarn> </PackageReference> </ItemGroup> </Project> 包括“ Nugettweaksforsimulators.targets”的“ nugettweaksforsimults”: <Import Project="NugetTweaksForSimulators.targets"/> 得出!

回答 1 投票 0

如何构建Skiasharp项目? libskiasharp.dll缺少?

荒谬的是,有时我不能自己构建一些开源项目。在这里,用于SkiaSharp.Desktop(大解决方案Skiasharp中的一个绑定项目)。我通过单击

回答 1 投票 0

MMSBUILD-等待X秒

在msbuild中做到这一点的最好方法是什么? 我的停止任务看起来像这样...

回答 2 投票 0

Wixlght1076:ICE60警告EXES和FONTS

我有一个Wix项目,目前正在将我的二进制.exes标记为字体,因此我对每个EXE都有一些X78警告。这是myFragment.wxs中的一个这样的文件条目: 我有一个Wix项目,目前正在将我的二进制.exes标记为字体,因此我对每个EXE都有一些X78警告。这是myFragment.wxs中的一个这样的文件条目: <Component Id="cmp20F34700D8DCC8F37E1363B995D59CB4" Guid="{DA56982D-9BBD-4682-A550-6E87648B7780}"> <File Id="filCE1CE5FF129A484DCCC047B9EB23D067" KeyPath="yes" Source="C:\myInstall\Release\EGPWS\EASE-2.3.1\Bin\TaskT.exe" /> </Component> 这是WIX安装程序构建日志的示例警告: C:\Tools\mystuff\Installers\apple\myFragment.wxs(1947): warning LGHT1076: ICE60: The file filCE1CE5FF129A484DCCC047B9EB23D067 is not a Font, and its version is not a companion file reference. It should have a language specified in the Language column. [C:\Tools\mystuff\Installers\apple\xyz.wixproj] 这些似乎是Matplotlib的TTF字体文件: <File Id="fil87B94718DF0A1E5F96CF5A83CADE52B9" KeyPath="yes" Source="C:\install_loc\Official\Release\Python\Lib\xyz-packages\matplotlib\mpl-data\fonts\ttf\cmb10.ttf" /> <File Id="fil30E628AF81327D8B4C15F0660D7DAC46" KeyPath="yes" Source="C:\install_loc\Official\Release\Python\Lib\xyz-packages\matplotlib\mpl-data\fonts\ttf\cmex10.ttf" /> <File Id="filDFA0B345DC913891B6C694A78C298511" KeyPath="yes" Source="C:\install_loc\Official\Release\Python\Lib\xyz-packages\matplotlib\mpl-data\fonts\ttf\cmmi10.ttf" /> <File Id="fil960ABA453AF97464A28824CC077B6584" KeyPath="yes" Source="C:\install_loc\Official\Release\Python\Lib\xyz-packages\matplotlib\mpl-data\fonts\ttf\cmr10.ttf" /> 我们正在使用Wix工具3.14 我认为这是Wix的错误,但我能够从这里为我们找出解决方案: WIX -ICE60和ICE69警告 特别地,您将这两个冲压标签添加到<PropertyGroup>中。上面的链接显示了如何在Visual Studio中完成的。 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> <OutputPath>bin\$(Configuration)\</OutputPath> <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath> <SuppressValidation>True</SuppressValidation> <SuppressIces>ICE60</SuppressIces> </PropertyGroup> 您误读错误消息: ICE60:文件filce1ce5ff129a484dcccccccccccc047b9eb23d067 is andnota font,其版本不是伴随文件参考。它应该在语言列中指定语言。 光明是我的。错误消息告诉您,您的EXE文件缺少语言资源,这是不寻常的。 ICE60是来自Microsoft的Windows Installer团队的静态分析工具,并在发货前试图捕获错误。 我的猜测是,您应该给您的.exe一个适当的语言资源。

回答 2 投票 0


我有一个Wix项目,目前正在将我的二进制.exes标记为字体,因此我对每个EXE都有一些X78警告。这是myFragment.wxs中的一个这样的文件条目:

这是WIX安装程序构建日志的示例警告: C:\Tools\mystuff\Installers\apple\myFragment.wxs(1947): warning LGHT1076: ICE60: The file filCE1CE5FF129A484DCCC047B9EB23D067 is not a Font, and its version is not a companion file reference. It should have a language specified in the Language column. [C:\Tools\mystuff\Installers\apple\xyz.wixproj] 我们正在使用Wix工具3.14 我认为这是Wix的错误,但我能够从这里为我们找出解决方案: WIX -ICE60和ICE69警告 特别是您将这两个层压标签添加到中 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> <OutputPath>bin\$(Configuration)\</OutputPath> <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath> <SuppressValidation>True</SuppressValidation> <SuppressIces>ICE60</SuppressIces> </PropertyGroup>

回答 1 投票 0

MMSBUILD:使用ClCompile

我有以下我在视觉工作室C ++项目中包含的道具文件: 我有以下我在视觉工作室C ++项目中包括以下道具文件: <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Target Name="GetGitRevision" BeforeTargets="ClCompile"> <Exec Command="git rev-parse --verify --short HEAD" ConsoleToMSBuild="true"> <Output TaskParameter="ConsoleOutput" PropertyName="GitRevision"/> </Exec> </Target> <ItemDefinitionGroup> <ClCompile> <PreprocessorDefinitions>GIT_REVISION="$(GitRevision)";%(PreprocessorDefinitions)</PreprocessorDefinitions> </ClCompile> </ItemDefinitionGroup> </Project> 我可以看到,目标GetGitRevision确实在编译之前被调用,并且输出与构建日志中的期望匹配。 但是,在C ++代码中,宏是由空定义的,这意味着解析时什么都看不到。 我做错了什么? 感谢乔纳森·多德斯(Jonathan Dodds)在评论中的解释。 应用建议后,以下对我有用:GIT_REVISION

回答 0 投票 0

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.