Skip to content

Commit 22dae79

Browse files
committed
Better Project Generator
1 parent 99a7df8 commit 22dae79

File tree

5 files changed

+38
-18
lines changed

5 files changed

+38
-18
lines changed

.gitignore

+13
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,19 @@ UpgradeLog*.XML
7979
UpgradeLog*.htm*
8080

8181
# files not to be commited
82+
83+
uncommitted/
84+
*.uncommitted.*
85+
*.uncommitted
86+
uncommitted
87+
uncommitted.*
88+
89+
*.gen.*
90+
*.gen
91+
gen
92+
gen.*
93+
*.orig
94+
8295
Uncommited.*
8396
Uncommited/
8497
*.TMP

Lambda2Js.Tests/Lambda2Js.Tests.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
<Compile Include="**\*.cs" Exclude="obj\**;bin\**" />
2929
<Compile Condition="'$(TargetFramework)'!='net40'" Remove="**\*.net40.cs" />
3030
<Compile Condition="'$(TargetFramework)'!='netcoreapp1.1'" Remove="**\*.netcoreapp1.1.cs" />
31+
<Compile Condition="'$(TargetFramework)'!='netcoreapp2.0'" Remove="**\*.netcoreapp2.0.cs" />
3132
<Compile Condition="$(TargetFramework.StartsWith('netcoreapp'))==False" Remove="**\*.netcoreapp.cs" />
3233
<EmbeddedResource Include="**\*.resx" />
3334
</ItemGroup>

Lambda2Js/Lambda2Js.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ See the project page for more.</Description>
4242
<OutputPath>bin\Release\</OutputPath>
4343
</PropertyGroup>
4444

45-
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netstandard1.0|AnyCPU'">
45+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
4646
<OutputPath>bin\Debug\</OutputPath>
4747
</PropertyGroup>
4848

ProjectsGenerator/Program.cs

+23-14
Original file line numberDiff line numberDiff line change
@@ -6,70 +6,79 @@ namespace ProjectsGenerator
66
{
77
class Program
88
{
9+
private static readonly string ProjectName = "Lambda2Js";
10+
911
static void Main(string[] args)
1012
{
1113
Console.WriteLine($"Environment.CurrentDirectory = {Environment.CurrentDirectory}");
1214

1315
// TEST PROJECTS:
1416
//
1517
// Test projects are generated from the main multi-targeted test project:
16-
// "Lambda2Js.Tests.csproj" file.
18+
// "{ProjectName}.Tests.csproj" file.
1719

1820
{
1921

2022
var l2jsTests = new XmlDocument();
21-
l2jsTests.Load("../Lambda2Js.Tests/Lambda2Js.Tests.csproj");
23+
l2jsTests.Load($"../{ProjectName}.Tests/{ProjectName}.Tests.csproj");
2224

2325
var targetsElement = l2jsTests.SelectNodes("//TargetFrameworks");
2426
Console.WriteLine(targetsElement[0].InnerText);
2527
var targets = targetsElement[0].InnerText.Split(";");
2628
foreach (var target in targets)
2729
{
28-
if (File.Exists($"../Lambda2Js.Tests/Lambda2Js.Tests.{target}.csproj"))
30+
if (File.Exists($"../{ProjectName}.Tests/{ProjectName}.Tests.{target}.csproj"))
2931
continue;
3032

3133
var l2jsTestNew = (XmlDocument)l2jsTests.Clone();
3234
var node = l2jsTestNew.SelectSingleNode("//TargetFrameworks");
3335
var targetElement = l2jsTestNew.CreateElement("TargetFramework");
3436
targetElement.InnerText = target;
3537
node.ParentNode.ReplaceChild(targetElement, node);
36-
l2jsTestNew.Save($"../Lambda2Js.Tests/Lambda2Js.Tests.{target}.csproj");
38+
l2jsTestNew.Save($"../{ProjectName}.Tests/{ProjectName}.Tests.{target}.csproj");
3739
}
3840

3941
}
4042

4143
// SIGNED ASSEMBLY
4244
//
43-
// Signed assembly is generated from the main "Lambda2Js.csproj" file.
45+
// Signed assembly is generated from the main "{ProjectName}.csproj" file.
4446

4547
{
4648

4749
var l2js = new XmlDocument();
48-
l2js.Load("../Lambda2Js/Lambda2Js.csproj");
50+
l2js.Load($"../{ProjectName}/{ProjectName}.csproj");
4951

5052
var sig = (XmlDocument)l2js.Clone();
5153
var sigMain = sig.SelectSingleNode("//TargetFrameworks").ParentNode;
5254
var ver = sigMain.SelectSingleNode("Version").InnerText;
5355

5456
sigMain.SelectSingleNode("AssemblyVersion").InnerText = $"{ver}.0";
5557
sigMain.SelectSingleNode("FileVersion").InnerText = $"{ver}.0";
56-
sigMain.SelectSingleNode("PackageId").InnerText = "Lambda2Js.Signed";
58+
sigMain.SelectSingleNode("PackageId").InnerText += ".Signed";
5759
sigMain.AppendChild(sig.CreateElement("SignAssembly").With(x => x.InnerText = "true"));
58-
sigMain.AppendChild(sig.CreateElement("AssemblyOriginatorKeyFile").With(x => x.InnerText = @"..\Lambda2Js.snk"));
59-
sigMain.AppendChild(sig.CreateElement("RootNamespace").With(x => x.InnerText = "Lambda2Js"));
60-
sigMain.AppendChild(sig.CreateElement("AssemblyName").With(x => x.InnerText = "Lambda2Js.Signed"));
60+
sigMain.AppendChild(sig.CreateElement("AssemblyOriginatorKeyFile").With(x => x.InnerText = $@"..\{ProjectName}.snk"));
61+
62+
if (sigMain.SelectSingleNode("RootNamespace") == null)
63+
sigMain.AppendChild(sig.CreateElement("RootNamespace").With(x => x.InnerText = $"{ProjectName}"));
6164

62-
foreach (XmlNode doc in sig.SelectNodes("DocumentationFile"))
63-
doc.InnerText = doc.InnerText.Replace("Lambda2Js.xml", "Lambda2Js.Signed.xml");
65+
if (sigMain.SelectSingleNode("AssemblyName") == null)
66+
sigMain.AppendChild(sig.CreateElement("AssemblyName").With(x => x.InnerText = $"{ProjectName}.Signed"));
67+
else
68+
sigMain.SelectSingleNode("AssemblyName").InnerText += ".Signed";
6469

65-
sig.Save($"../Lambda2Js/Lambda2Js.Signed.csproj");
70+
foreach (XmlNode doc in sig.SelectNodes("//DocumentationFile"))
71+
doc.InnerText = doc.InnerText.Replace($"{ProjectName}.xml", $"{ProjectName}.Signed.xml");
72+
73+
sig.Save($"../{ProjectName}/{ProjectName}.Signed.csproj");
6674

6775
}
6876

69-
Console.WriteLine("Hello World!");
77+
Console.WriteLine("Press any key to exit");
7078
Console.ReadKey();
7179
}
7280
}
81+
7382
static class ObjectExtensions
7483
{
7584
public static T With<T>(this T obj, Action<T> action)

Test.Net-v4.0/Test.Net-v4.0.csproj

-3
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@
3232
<WarningLevel>4</WarningLevel>
3333
</PropertyGroup>
3434
<ItemGroup>
35-
<Reference Include="Lambda2Js, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
36-
<HintPath>..\packages\Lambda2Js.2.0.0\lib\portable40-net40+sl5+win8+wp8+wpa81\Lambda2Js.dll</HintPath>
37-
</Reference>
3835
<Reference Include="System" />
3936
<Reference Include="System.Core" />
4037
<Reference Include="System.Xml.Linq" />

0 commit comments

Comments
 (0)