5
5
using System . Collections ;
6
6
using System . Collections . Generic ;
7
7
using System . Diagnostics ;
8
- using System . Globalization ;
9
8
using System . IO ;
10
9
using System . Linq ;
10
+ using System . Runtime . InteropServices ;
11
11
using System . Text ;
12
12
using System . Threading . Tasks ;
13
13
using System . Xml ;
@@ -106,6 +106,7 @@ internal virtual Task ProcessExtensionsProject(string projectFolder)
106
106
107
107
try
108
108
{
109
+ string runtimeIdentifierParameter = GetRuntimeIdentifierParameter ( ) ;
109
110
var startInfo = new ProcessStartInfo
110
111
{
111
112
FileName = dotnetPath ,
@@ -115,7 +116,7 @@ internal virtual Task ProcessExtensionsProject(string projectFolder)
115
116
UseShellExecute = false ,
116
117
ErrorDialog = false ,
117
118
WorkingDirectory = projectFolder ,
118
- Arguments = $ "build \" { ExtensionsProjectFileName } \" -o bin --force --no-incremental"
119
+ Arguments = $ "build \" { ExtensionsProjectFileName } \" -o bin --force --no-incremental { runtimeIdentifierParameter } "
119
120
} ;
120
121
121
122
string nugetPath = Path . Combine ( Path . GetDirectoryName ( ProjectPath ) , "nuget.config" ) ;
@@ -232,14 +233,41 @@ private ProjectRootElement CreateDefaultProject(string path)
232
233
var root = ProjectRootElement . Create ( path , NewProjectFileOptions . None ) ;
233
234
root . Sdk = "Microsoft.NET.Sdk" ;
234
235
235
- root . AddPropertyGroup ( )
236
- . AddProperty ( "TargetFramework" , "netstandard2.0" ) ;
236
+ var propGroup = root . AddPropertyGroup ( ) ;
237
+ propGroup . AddProperty ( "TargetFramework" , "netstandard2.0" ) ;
238
+ propGroup . AddProperty ( "WarningsAsErrors" , string . Empty ) ;
237
239
238
240
root . AddItemGroup ( )
239
241
. AddItem ( PackageReferenceElementName , ExtensionsPackageId )
240
242
. AddMetadata ( PackageReferenceVersionElementName , "1.0.0-beta2" , true ) ;
241
243
242
244
return root ;
243
245
}
246
+
247
+ private static string GetRuntimeIdentifierParameter ( )
248
+ {
249
+ string os = null ;
250
+
251
+ if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
252
+ {
253
+ os = "win" ;
254
+ }
255
+ else if ( RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) )
256
+ {
257
+ os = "osx" ;
258
+ }
259
+ else if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) )
260
+ {
261
+ os = "linux" ;
262
+ }
263
+ else
264
+ {
265
+ return string . Empty ;
266
+ }
267
+
268
+ string arch = RuntimeInformation . ProcessArchitecture . ToString ( ) . ToLowerInvariant ( ) ;
269
+
270
+ return $ "-r { os } -{ arch } ";
271
+ }
244
272
}
245
273
}
0 commit comments