diff --git a/src/Templates/tests/Directory.Build.props b/src/Templates/tests/Directory.Build.props
index faf2349bae2d..4c8322661c73 100644
--- a/src/Templates/tests/Directory.Build.props
+++ b/src/Templates/tests/Directory.Build.props
@@ -1,3 +1,7 @@
+
+ true
+
+
diff --git a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs
index 243e027a01a4..8966ab8dd124 100644
--- a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs
+++ b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs
@@ -92,6 +92,26 @@ public void PackCoreLib(string id, string framework, string config)
$"Project {Path.GetFileName(projectFile)} failed to build. Check test output/attachments for errors.");
}
+ [Test]
+ [TestCase("maui", "net7.0", "Debug", "Update")]
+ [TestCase("maui", "net7.0", "Debug", "Include")]
+ public void BuildWithPackageReference(string id, string framework, string config, string type)
+ {
+ var projectDir = TestDirectory;
+ var projectFile = Path.Combine(projectDir, $"{Path.GetFileName(projectDir)}.csproj");
+
+ Assert.IsTrue(DotnetInternal.New(id, projectDir, framework),
+ $"Unable to create template {id}. Check test output for errors.");
+
+ EnableTizen(projectFile);
+ FileUtilities.ReplaceInFile(projectFile,
+ "",
+ "");
+
+ Assert.IsTrue(DotnetInternal.Build(projectFile, config, properties: BuildProps),
+ $"Project {Path.GetFileName(projectFile)} failed to build. Check test output/attachments for errors.");
+ }
+
void EnableTizen(string projectFile)
{
FileUtilities.ReplaceInFile(projectFile, new Dictionary()
diff --git a/src/Workload/Microsoft.Maui.Sdk/Microsoft.Maui.Sdk.csproj b/src/Workload/Microsoft.Maui.Sdk/Microsoft.Maui.Sdk.csproj
index 0e47d3900135..fa929ca2d617 100644
--- a/src/Workload/Microsoft.Maui.Sdk/Microsoft.Maui.Sdk.csproj
+++ b/src/Workload/Microsoft.Maui.Sdk/Microsoft.Maui.Sdk.csproj
@@ -36,38 +36,6 @@
DependsOnTargets="SetVersions"
Inputs="$(MSBuildProjectFile);$(MauiRootDirectory)eng/Versions.props;Sdk/BundledVersions.in.targets"
Outputs="$(IntermediateOutputPath)BundledVersions.targets">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <_ValuesToReplace Include="_XamarinAndroidXBrowserVersion" PropertyName="_XamarinAndroidXBrowserVersion" />
- <_ValuesToReplace Include="_XamarinAndroidXSwipeRefreshLayoutVersion" PropertyName="_XamarinAndroidXSwipeRefreshLayoutVersion" />
- <_ValuesToReplace Include="_XamarinAndroidXLifecycleLiveDataVersion" PropertyName="_XamarinAndroidXLifecycleLiveDataVersion" />
- <_ValuesToReplace Include="_XamarinAndroidXNavigationVersion" PropertyName="_XamarinAndroidXNavigationVersion" />
- <_ValuesToReplace Include="_XamarinGoogleAndroidMaterialVersion" PropertyName="_XamarinGoogleAndroidMaterialVersion" />
-
+
+
+
+
+
+
+
+
+
diff --git a/src/Workload/Microsoft.Maui.Sdk/Sdk/AutoImport.in.props b/src/Workload/Microsoft.Maui.Sdk/Sdk/AutoImport.in.props
new file mode 100644
index 000000000000..fc00f7395f3d
--- /dev/null
+++ b/src/Workload/Microsoft.Maui.Sdk/Sdk/AutoImport.in.props
@@ -0,0 +1,39 @@
+
+
+
+
+ <_MauiImplicitPackageReference Include="Microsoft.Maui.Resizetizer" Version="$(MauiVersion)" PrivateAssets="all" Condition=" '$(UseMauiAssets)' == 'true' " />
+ <_MauiImplicitPackageReference Include="Microsoft.Maui.Essentials" Version="$(MauiVersion)" Condition=" '$(UseMauiEssentials)' == 'true' ">
+ all
+
+ <_MauiImplicitPackageReference Include="Microsoft.Maui.Core" Version="$(MauiVersion)" Condition=" '$(UseMauiCore)' == 'true' ">
+ all
+
+ <_MauiImplicitPackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" Condition=" '$(UseMaui)' == 'true' ">
+ all
+
+ <_MauiImplicitPackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" Condition=" '$(UseMaui)' == 'true' and '$(UseMauiCompat)' == 'true' ">
+ all
+
+ <_MauiImplicitPackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="$(MauiVersion)" Condition=" '$(UseMaui)' == 'true' and '$(UsingMicrosoftNETSdkRazor)' == 'true' ">
+ all
+
+
+
+
+
+
+
diff --git a/src/Workload/Microsoft.Maui.Sdk/Sdk/AutoImport.props b/src/Workload/Microsoft.Maui.Sdk/Sdk/AutoImport.props
deleted file mode 100644
index 058246e40862..000000000000
--- a/src/Workload/Microsoft.Maui.Sdk/Sdk/AutoImport.props
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/src/Workload/Microsoft.Maui.Sdk/Sdk/BundledVersions.in.targets b/src/Workload/Microsoft.Maui.Sdk/Sdk/BundledVersions.in.targets
index 91ab6b53d92e..77111395d0fc 100644
--- a/src/Workload/Microsoft.Maui.Sdk/Sdk/BundledVersions.in.targets
+++ b/src/Workload/Microsoft.Maui.Sdk/Sdk/BundledVersions.in.targets
@@ -3,9 +3,10 @@
@VERSION@
@TFM@
+ @MAUI_DOTNET_VERSION@
$(MauiWorkloadVersion)
-
-
- <_MauiImplicitPackageReference Include="Microsoft.Maui.Resizetizer" Version="$(MauiVersion)" PrivateAssets="all" />
-
-
- <_MauiImplicitPackageReference Include="Microsoft.Maui.Essentials" Version="$(MauiVersion)">
- all
-
-
-
- <_MauiImplicitPackageReference Include="Microsoft.Maui.Core" Version="$(MauiVersion)">
- all
-
-
-
- <_MauiImplicitPackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)">
- all
-
-
-
- <_MauiImplicitPackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)">
- all
-
-
-
- <_MauiImplicitPackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="$(MauiVersion)">
- all
-
-
-
-
- <_MauiRequiredImplicitPackageReference Remove="@(PackageReference)" />
-
-
-
-
- <_MauiImplicitPackageReference Remove="@(PackageReference)" />
-
+
+ <_MauiAddedImplicitMauiPackageReference Include="@(PackageReference->HasMetadata('IsMauiImplicitPackageReference'))" />
+ <_MauiAddedUserNonMauiPackageReference Include="@(PackageReference)" Exclude="@(_MauiAddedImplicitMauiPackageReference)" />
+ <_MauiAddedUserAllPackageReference Include="@(PackageReference->WithMetadataValue('IsMauiImplicitPackageReference',''))" />
+ <_MauiAddedUserMauiPackageReference Include="@(_MauiAddedUserAllPackageReference)" Exclude="@(_MauiAddedUserNonMauiPackageReference)" />
+
+
+
-
\ No newline at end of file
+