@@ -113,6 +113,33 @@ public void BuildUnpackaged(string id, string framework, string config)
113
113
$ "Project { Path . GetFileName ( projectFile ) } failed to build. Check test output/attachments for errors.") ;
114
114
}
115
115
116
+ [ Test ]
117
+ [ TestCase ( "maui" , true , true ) ]
118
+ [ TestCase ( "maui" , true , false ) ]
119
+ [ TestCase ( "maui" , false , true ) ]
120
+ public void BuildSelfContained ( string id , bool wasdkself , bool netself )
121
+ {
122
+ var projectDir = TestDirectory ;
123
+ var projectFile = Path . Combine ( projectDir , $ "{ Path . GetFileName ( projectDir ) } .csproj") ;
124
+
125
+ Assert . IsTrue ( DotnetInternal . New ( id , projectDir , DotNetCurrent ) ,
126
+ $ "Unable to create template { id } . Check test output for errors.") ;
127
+
128
+ FileUtilities . ReplaceInFile ( projectFile ,
129
+ "<UseMaui>true</UseMaui>" ,
130
+ $ """
131
+ <UseMaui>true</UseMaui>
132
+ <WindowsAppSDKSelfContained>{ wasdkself } </WindowsAppSDKSelfContained>
133
+ <SelfContained>{ netself } </SelfContained>
134
+ """ ) ;
135
+
136
+ var extendedBuildProps = BuildProps ;
137
+ extendedBuildProps . Add ( $ "TargetFramework={ DotNetCurrent } -windows10.0.19041.0") ;
138
+
139
+ Assert . IsTrue ( DotnetInternal . Build ( projectFile , "Release" , properties : extendedBuildProps , msbuildWarningsAsErrors : true ) ,
140
+ $ "Project { Path . GetFileName ( projectFile ) } failed to build. Check test output/attachments for errors.") ;
141
+ }
142
+
116
143
[ Test ]
117
144
[ TestCase ( "maui" , $ "{ DotNetCurrent } -ios", "ios-arm64" ) ]
118
145
public void PublishNativeAOT ( string id , string framework , string runtimeIdentifier )
0 commit comments