简体   繁体   English

.NET MAUI.csproj MSBUILD

[英].NET MAUI .csproj MSBUILD

When I am developing my MAUI application and I press build.当我开发我的 MAUI 应用程序时,我按下构建。 The build process runs for all platforms (I am on windows).构建过程适用于所有平台(我在 Windows 上)。 But what I want to achieve is build specific to emulator and configuration I have chosen, to speed things up.但我想要实现的是构建特定于我选择的模拟器和配置,以加快速度。

I develop mobile app for android and iOS but sometimes I test it on Windows and my colegues on MAC.我为 android 和 iOS 开发移动应用程序,但有时我在 Windows 和我的 MAC 同事上测试它。

So for release it is simple:所以对于发布来说很简单:

<PropertyGroup Condition="'$(Configuration)' == 'Release'">
    <TargetFrameworks>net6.0-android;net6.0-ios</TargetFrameworks>
</PropertyGroup>

but for Debug we currently have just:但对于调试,我们目前只有:

<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
    <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net6.0-windows10.0.19041.0</TargetFrameworks>
    <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('osx'))">$(TargetFrameworks);net6.0-maccatalyst</TargetFrameworks>
</PropertyGroup>

What we want to achieve is build specific to current debug emulator/machine that is specified up here: https://i.imgur.com/mFZTuCn.png我们想要实现的是构建特定于此处指定的当前调试模拟器/机器: https://i.imgur.com/mFZTuCn.png

So in case we have chosen所以如果我们选择

on the other hand另一方面

Is something like this even possible?这样的事情甚至可能吗? Yes, I could theoretically temporarily comment out those frameworks I dont want to build for, but I would rather solve it the MSBUILD way.是的,理论上我可以暂时注释掉那些我不想为其构建的框架,但我宁愿以 MSBUILD 的方式解决它。

But what I want to achieve is build specific to emulator and configuration I have chosen, to speed things up.但我想要实现的是构建特定于我选择的模拟器和配置,以加快速度。

You can right click on.csproj and then click Properties.您可以右键单击.csproj,然后单击“属性”。 In Application, uncheck the platform you don't want to build.在应用程序中,取消选中您不想构建的平台。 It will automatically comment out those frameworks you don't want to build for.它会自动注释掉那些你不想为其构建的框架。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM