-
Notifications
You must be signed in to change notification settings - Fork 214
/
MsBuildProjectStrings.cs
343 lines (309 loc) · 12.2 KB
/
MsBuildProjectStrings.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.IO;
using System.Xml;
namespace Microsoft.VisualStudio.Web.CodeGeneration
{
internal class MsBuildProjectStrings
{
public const string RootProjectName = "Test.csproj";
public const string PropsFileTxt = @"<Project>
<PropertyGroup>
<RestoreSources>$(DotNetRestoreSources)</RestoreSources>
<ArtifactsDir>{0}</ArtifactsDir>
<RestoreSources Condition=""'$(DotNetBuildOffline)' != 'true'"">
$(RestoreSources);
https://dotnet.myget.org/F/aspnet-2-0-2-october2017-patch/api/v3/index.json;
https://dotnet.myget.org/F/aspnetcore-master/api/v3/index.json;
https://dotnet.myget.org/F/aspnetcore-tools/api/v3/index.json;
https://api.nuget.org/v3/index.json;
$(ArtifactsDir);
</RestoreSources>
</PropertyGroup>
</Project>";
public const string RootProjectTxt = @"
<Project ToolsVersion=""15.0"" Sdk=""Microsoft.NET.Sdk.Web"">
<Import Project=""..\Shared.props"" />
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<RootNamespace>Microsoft.TestProject</RootNamespace>
<ProjectName>TestProject</ProjectName>
<NoWarn>NU1605</NoWarn>
<RuntimeFrameworkVersion>{2}</RuntimeFrameworkVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include=""Microsoft.ApplicationInsights.AspNetCore"" Version=""2.1.1"" />
<PackageReference Include=""Microsoft.AspNetCore"" Version=""{3}"" />
<PackageReference Include=""Microsoft.AspNetCore.Mvc"" Version=""{3}"" />
<PackageReference Include=""Microsoft.AspNetCore.StaticFiles"" Version=""{3}"" />
<PackageReference Include=""Microsoft.Extensions.Logging.Debug"" Version=""{0}"" />
<PackageReference Include=""Microsoft.VisualStudio.Web.BrowserLink"" Version=""{3}"" />
</ItemGroup>
<ItemGroup>
<PackageReference Include=""Microsoft.AspNetCore.Authentication.Cookies"" Version=""{3}"" />
<PackageReference Include=""Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore"" Version=""{3}"" />
<PackageReference Include=""Microsoft.AspNetCore.Identity.EntityFrameworkCore"" Version=""{3}"" />
<PackageReference Include=""Microsoft.EntityFrameworkCore.Design"" Version=""{3}"" />
<PackageReference Include=""Microsoft.EntityFrameworkCore.SqlServer"" Version=""{3}"" />
<PackageReference Include=""Microsoft.Extensions.Configuration.UserSecrets"" Version=""{0}"" />
<PackageReference Include=""Microsoft.VisualStudio.Web.CodeGeneration.Design"" Version=""{1}"" />
<PackageReference Include=""Microsoft.VisualStudio.Web.CodeGeneration.Tools"" Version=""{1}"" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include=""Microsoft.VisualStudio.Web.CodeGeneration.Tools"" Version=""{1}"" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include=""..\Library1\Library1.csproj"" />
</ItemGroup>
<ItemGroup>
<Reference Include = ""xyz.dll"" />
</ItemGroup>
</Project>
";
public const string RootProjectTxtWithoutEF = @"
<Project ToolsVersion=""15.0"" Sdk=""Microsoft.NET.Sdk.Web"">
<Import Project=""..\Shared.props"" />
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<RootNamespace>Microsoft.TestProject</RootNamespace>
<ProjectName>TestProject</ProjectName>
<NoWarn>NU1605</NoWarn>
<RuntimeFrameworkVersion>{2}</RuntimeFrameworkVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include=""Microsoft.ApplicationInsights.AspNetCore"" Version=""2.1.1"" />
<PackageReference Include=""Microsoft.AspNetCore"" Version=""{3}"" />
<PackageReference Include=""Microsoft.AspNetCore.Mvc"" Version=""{3}"" />
<PackageReference Include=""Microsoft.AspNetCore.StaticFiles"" Version=""{3}"" />
<PackageReference Include=""Microsoft.Extensions.Logging.Debug"" Version=""{0}"" />
<PackageReference Include=""Microsoft.VisualStudio.Web.BrowserLink"" Version=""{3}"" />
</ItemGroup>
<ItemGroup>
<PackageReference Include=""Microsoft.AspNetCore.Authentication.Cookies"" Version=""{3}"" />
<PackageReference Include=""Microsoft.Extensions.Configuration.UserSecrets"" Version=""{0}"" />
<PackageReference Include=""Microsoft.VisualStudio.Web.CodeGeneration.Design"" Version=""{1}"" />
<PackageReference Include=""Microsoft.VisualStudio.Web.CodeGeneration.Tools"" Version=""{1}"" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include=""Microsoft.VisualStudio.Web.CodeGeneration.Tools"" Version=""{1}"" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include=""..\Library1\Library1.csproj"" />
</ItemGroup>
<ItemGroup>
<Reference Include = ""xyz.dll"" />
</ItemGroup>
</Project>
";
public const string RootNet45ProjectTxt = @"
<Project Sdk=""Microsoft.NET.Sdk"">
<Import Project=""..\Shared.props"" />
<PropertyGroup>
<RootNamespace>Microsoft.TestProject</RootNamespace>
<ProjectName>TestProject</ProjectName>
<OutputType>EXE</OutputType>
<TargetFrameworks>net461</TargetFrameworks>
<OutputPath>bin\$(Configuration)</OutputPath>
<RuntimeIdentifier>win7-x64</RuntimeIdentifier>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<NoWarn>NU1605</NoWarn>
<RuntimeFrameworkVersion>{2}</RuntimeFrameworkVersion>
</PropertyGroup>
<ItemGroup>
<Compile Include=""**\*.cs"" Exclude=""Excluded.cs;$(DefaultItemExcludes)"" />
</ItemGroup>
<ItemGroup>
<PackageReference Include=""Microsoft.AspNetCore.Diagnostics"" Version=""{3}"" />
<PackageReference Include=""Microsoft.AspNetCore.Mvc"" Version=""{3}"" />
<PackageReference Include=""Microsoft.AspNetCore.Server.IISIntegration"" Version=""{3}"" />
<PackageReference Include=""Microsoft.AspNetCore.Server.Kestrel"" Version=""{3}"" />
<PackageReference Include=""Microsoft.AspNetCore.StaticFiles"" Version=""{3}"" />
<PackageReference Include=""Microsoft.Extensions.Configuration.EnvironmentVariables"" Version=""{0}"" />
<PackageReference Include=""Microsoft.Extensions.Configuration.Json"" Version=""{0}"" />
<PackageReference Include=""Microsoft.Extensions.Logging"" Version=""{0}"" />
<PackageReference Include=""Microsoft.Extensions.Logging.Console"" Version=""{0}"" />
<PackageReference Include=""Microsoft.Extensions.Logging.Debug"" Version=""{0}"" />
<PackageReference Include=""Microsoft.Extensions.Options.ConfigurationExtensions"" Version=""{0}"" />
<PackageReference Include=""Microsoft.VisualStudio.Web.CodeGeneration.Design"" Version=""{1}"" />
<DotNetCliToolReference Include=""Microsoft.VisualStudio.Web.CodeGeneration.Tools"" Version=""{1}"" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include=""..\Library1\Library1.csproj"" />
</ItemGroup>
<ItemGroup>
<Reference Include = ""xyz.dll"" />
</ItemGroup>
</Project>
";
public const string StartupTxt = @"using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.EntityFrameworkCore;
namespace WebApplication1
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddMvc();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseStaticFiles();
CS7_method(out var i);
app.UseMvc(routes =>
{
routes.MapRoute(
name: ""default"",
template: ""{controller=Home}/{action=Index}/{id?}"");
});
}
private void CS7_method(out int i)
{
i = 1;
}
}
}
";
public const string StartupTxtWithoutEf = @"using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace WebApplication1
{
public class Startup
{
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile(""appsettings.json"", optional: true, reloadOnChange: true);
//.AddJsonFile($""appsettings.{env.EnvironmentName}.json"", optional: true);
Configuration = builder.Build();
}
public IConfigurationRoot Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddMvc();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: ""default"",
template: ""{controller=Home}/{action=Index}/{id?}"");
});
}
}
}
";
public const string ProgramFileName = "Program.cs";
public const string ProgramFileText = @"using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
namespace WebApplication1
{
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost
.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.Build();
}
}
";
public const string LibraryProjectName = "Library1.csproj";
public const string LibraryProjectTxt = @"
<Project Sdk=""Microsoft.NET.Sdk"">
<Import Project=""..\Shared.props"" />
<PropertyGroup>
<RootNamespace>Microsoft.Library</RootNamespace>
<ProjectName>Library1</ProjectName>
<OutputType>Library</OutputType>
<TargetFramework>netstandard2.0</TargetFramework>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
</PropertyGroup>
<ItemGroup>
<Compile Include=""**\*.cs"" Exclude=""Excluded.cs;$(DefaultItemExcludes)"" />
</ItemGroup>
</Project>
";
public const string ProductTxt = @"
using System;
using System.Collections.Generic;
//using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace WebApplication1.Models
{
public class Product
{
public int ProductID { get; set; }
public string Name { get; set; }
public double Price { get; set; }
public int ManufacturerID { get; set; }
public Manufacturer Manufacturer { get; set; }
}
public class Manufacturer
{
public int ManufacturerID { get; set; }
// [Required]
public string Name { get; set; }
}
}
";
public const string CarTxt = @"
using System.Collections.Generic;
namespace Library1.Models
{
public class Car
{
public string ID { get; set; }
public string Name { get; set; }
public int ManufacturerID { get; set; }
public Manufacturer Manufacturer { get; set; }
}
public class Manufacturer
{
public int ID { get; set; }
public string Name { get; set; }
public virtual ICollection<Car> Cars { get; set; }
}
}";
}
}