[go: nahoru, domu]

Skip to content

Commit

Permalink
Visual Studio seems to have changed the directory to run .Net Core 2:…
Browse files Browse the repository at this point in the history
… before - run from csproj dir; now - run from \bin dir
  • Loading branch information
masbicudo committed Apr 22, 2018
1 parent 00505dc commit f2e17de
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 12 deletions.
8 changes: 8 additions & 0 deletions Fluent-Json.NET-Configuration.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INITIALIZER_BRACES/@EntryValue">NEXT_LINE_SHIFTED_2</s:String>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_BLANK_LINES_IN_DECLARATIONS/@EntryValue">2</s:Int64>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/LINE_FEED_AT_FILE_END/@EntryValue">True</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_ACCESSOR_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">NEVER</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_ACCESSORHOLDER_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">NEVER</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_CONSTRUCTOR_INITIALIZER_ON_SAME_LINE/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_ACCESSOR_ATTRIBUTE_ON_SAME_LINE/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_EMBEDDED_STATEMENT_ON_SAME_LINE/@EntryValue">NEVER</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_TYPE_CONSTRAINTS_ON_SAME_LINE/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_WHILE_ON_NEW_LINE/@EntryValue">True</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SIMPLE_EMBEDDED_STATEMENT_STYLE/@EntryValue">LINE_BREAK</s:String>
Expand All @@ -54,7 +57,12 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticReadonly/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PublicFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
<s:Boolean x:Key="/Default/Environment/SearchAndNavigation/NavigateByControlClick/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpAttributeForSingleLineMethodUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpRenamePlacementToArrangementMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002ECSharpPlaceAttributeOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean>
</wpf:ResourceDictionary>
44 changes: 32 additions & 12 deletions ProjectGenerator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ class Program

static void Main(string[] args)
{
Console.WriteLine($"Environment.CurrentDirectory = {Environment.CurrentDirectory}");

foreach (var verKv in JsonNetVersions)
{
var jsonNetVerMajor = verKv.Key.Substring(0, verKv.Key.IndexOf('.'));
Expand Down Expand Up @@ -83,10 +81,15 @@ static void Main(string[] args)

{

var l2jsTests = new XmlDocument();
l2jsTests.Load($"../{TestProjectName}/{TestProjectName}.Lib_v{jsonNetVerMajor}.csproj");
var testsProjXml = new XmlDocument();
var pathProj = $"../{TestProjectName}/{TestProjectName}.Lib_v{jsonNetVerMajor}.csproj";

FindAndSetCurrentPath(pathProj);
Console.WriteLine($"Environment.CurrentDirectory = {Environment.CurrentDirectory}");

var targetsElement = l2jsTests.SelectNodes("//TargetFrameworks");
testsProjXml.Load(pathProj);

var targetsElement = testsProjXml.SelectNodes("//TargetFrameworks");
Console.WriteLine(targetsElement[0].InnerText);
var targetsProj = targetsElement[0].InnerText.Split(";");
Console.WriteLine(targetsElement[0].InnerText);
Expand Down Expand Up @@ -135,13 +138,13 @@ static void Main(string[] args)
}
else
{
var l2jsTestNew = (XmlDocument)l2jsTests.Clone();
var node = l2jsTestNew.SelectSingleNode("//TargetFrameworks");
var targetElement = l2jsTestNew.CreateElement("TargetFramework");
var testProjXml_2 = (XmlDocument)testsProjXml.Clone();
var node = testProjXml_2.SelectSingleNode("//TargetFrameworks");
var targetElement = testProjXml_2.CreateElement("TargetFramework");
targetElement.InnerText = target;
node.ParentNode.ReplaceChild(targetElement, node);

SaveXmlDoc(l2jsTestNew, $"../{TestProjectName}/{TestProjectName}.Lib_v{jsonNetVerMajor}.{target}.csproj");
SaveXmlDoc(testProjXml_2, $"../{TestProjectName}/{TestProjectName}.Lib_v{jsonNetVerMajor}.{target}.csproj");
}
}

Expand All @@ -153,10 +156,10 @@ static void Main(string[] args)

{

var l2js = new XmlDocument();
l2js.Load($"../{ProjectName}/{ProjectName}.Lib_v{jsonNetVerMajor}.csproj");
var projXml = new XmlDocument();
projXml.Load($"../{ProjectName}/{ProjectName}.Lib_v{jsonNetVerMajor}.csproj");

var sig = (XmlDocument)l2js.Clone();
var sig = (XmlDocument)projXml.Clone();
var sigMain = sig.SelectSingleNode("//TargetFrameworks").ParentNode;
var ver = sigMain.SelectSingleNode("Version").InnerText;

Expand Down Expand Up @@ -185,6 +188,23 @@ static void Main(string[] args)
Console.ReadKey(intercept: true);
}

private static void FindAndSetCurrentPath(string pathProj)
{
while (true)
{
try
{
if (File.Exists(pathProj))
break;
}
catch (Exception)
{
}

Environment.CurrentDirectory = Path.GetDirectoryName(Environment.CurrentDirectory);
}
}

private static void SaveXmlDoc(XmlDocument xmldoc, string fileName)
{
string oldFileText = null;
Expand Down

0 comments on commit f2e17de

Please sign in to comment.