diff --git a/.idea/artifacts/migrator.xml b/.idea/artifacts/migrator.xml
new file mode 100644
index 0000000..9ea2204
--- /dev/null
+++ b/.idea/artifacts/migrator.xml
@@ -0,0 +1,11 @@
+
+
+ $PROJECT_DIR$/out/artifacts/migrator
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/dictionaries/mcd.xml b/.idea/dictionaries/mcd.xml
new file mode 100644
index 0000000..a4dab89
--- /dev/null
+++ b/.idea/dictionaries/mcd.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..d2ccdac
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ Android
+
+
+
+
+
+
+
+
+
+ C:\Users\mcd\AppData\Roaming\Subversion
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..5948db3
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..9c39aa1
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,902 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ moni
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ DEFINITION_ORDER
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1496055508030
+
+
+ 1496055508030
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ xtend;xtext
+ rO0ABXNyADtvcmcuZWNsaXBzZS54dGV4dC5yZXNvdXJjZS5pbXBsLkNodW5rZWRSZXNvdXJjZURlc2NyaXB0aW9uc4nX+GBmyGixDAAAeHB3IQAAAAEAF1RhcmdldEZyYW1ld29ya01pZ3JhdG9yAAAAAHg=
+ rO0ABXNyABFqYXZhLnV0aWwuSGFzaE1hcAUH2sHDFmDRAwACRgAKbG9hZEZhY3RvckkACXRocmVzaG9sZHhwP0AAAAAAAAF3CAAAAAIAAAABdAAXVGFyZ2V0RnJhbWV3b3JrTWlncmF0b3JzcgAvb3JnLmVjbGlwc2UueHRleHQuYnVpbGQuU291cmNlMkdlbmVyYXRlZE1hcHBpbme98EFaw4LccwwAAHhwdwQAAAAAeHg=
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ migrator
+
+
+
+
+
+
+
+
+
+
+
+
+ No facets are configured
+
+
+
+
+
+
+
+
+
+
+
+ scala-sdk-2.12.0
+
+
+
+
+
+
+
+
+
+
+
+ 1.8
+
+
+
+
+
+
+
+
+
+
+
+ TargetFrameworkMigrator
+
+
+
+
+
+
+
+
+
+
+
+
+ 1.8
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/xtextAutoBuilderState.xml b/.idea/xtextAutoBuilderState.xml
new file mode 100644
index 0000000..dd0993f
--- /dev/null
+++ b/.idea/xtextAutoBuilderState.xml
@@ -0,0 +1,8 @@
+
+
+
+ xtend;xtext
+ rO0ABXNyADtvcmcuZWNsaXBzZS54dGV4dC5yZXNvdXJjZS5pbXBsLkNodW5rZWRSZXNvdXJjZURlc2NyaXB0aW9uc4nX+GBmyGixDAAAeHB3IQAAAAEAF1RhcmdldEZyYW1ld29ya01pZ3JhdG9yAAAAAHg=
+ rO0ABXNyABFqYXZhLnV0aWwuSGFzaE1hcAUH2sHDFmDRAwACRgAKbG9hZEZhY3RvckkACXRocmVzaG9sZHhwP0AAAAAAAAF3CAAAAAIAAAABdAAXVGFyZ2V0RnJhbWV3b3JrTWlncmF0b3JzcgAvb3JnLmVjbGlwc2UueHRleHQuYnVpbGQuU291cmNlMkdlbmVyYXRlZE1hcHBpbme98EFaw4LccwwAAHhwdwQAAAAAeHg=
+
+
\ No newline at end of file
diff --git a/META-INF/MANIFEST.MF b/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..8008376
--- /dev/null
+++ b/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: Program
+
diff --git a/README.md b/README.md
index b1ee9f4..79857a8 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,25 @@
-# TargetFrameworkMigrator
\ No newline at end of file
+# TargetFrameworkMigrator
+Simple tool to migrate the target framework for Visual Studio Projects Solution wide.
+
+## Requirements
+[Java 8 or higher](https://java.com/en/download/)
+
+## Usage
+[Download](https://github.com/Xpitfire/TargetFrameworkMigrator/releases) release java file.
+
+Open command prompt or PowerShell and execute:
+```
+java -jar migrator.jar -path= -recursive= -version=
+```
+
+Parameter | Description
+--- | ---
+-path | root path of the solution
+-version | parameter for defining the destination path
+-recursive | optional: by default recursive is set to false, to prevent unwanted recursive descent
+
+## Example
+
+```
+java -jar MonitoringRenamer.jar -path=C:/Worspace/Demo -recursive=true -version=v4.6.2
+```
diff --git a/TargetFrameworkMigrator.iml b/TargetFrameworkMigrator.iml
new file mode 100644
index 0000000..c90834f
--- /dev/null
+++ b/TargetFrameworkMigrator.iml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Program.java b/src/Program.java
new file mode 100644
index 0000000..04161b1
--- /dev/null
+++ b/src/Program.java
@@ -0,0 +1,164 @@
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.xpath.*;
+import java.io.*;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.FileHandler;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.logging.SimpleFormatter;
+
+/**
+ * Created by xpitfire on 28/05/2017.
+ */
+public class Program {
+
+ private static final String LOGGER_FILE_NAME = "TargetFrameworkMigrator.log";
+
+ private static Logger logger;
+
+ private static String path = null;
+ private static boolean recursive = false;
+ private static String version = null;
+
+ public static void main(String[] args) throws FileNotFoundException, UnsupportedEncodingException {
+
+ initLogger();
+
+ try {
+ if (args == null
+ || args.length < 1) {
+ System.err.println("Invalid parameter list!");
+ System.err.println("Missing path and text prefix.");
+ printErrorHelp();
+ return;
+ }
+
+ Map paramMap = new HashMap<>();
+
+ int idx = 0;
+
+ while (idx < args.length) {
+ String[] keyValue = args[idx].split("=");
+ if (keyValue.length < 2) continue;
+ paramMap.put(keyValue[0], keyValue[1]);
+ idx++;
+ }
+
+ // mandatory settings
+
+ if (paramMap.containsKey("-path")) {
+ path = paramMap.get("-path");
+ } else {
+ System.err.println("Invalid version parameter!");
+ printErrorHelp();
+ return;
+ }
+
+ if (paramMap.containsKey("-version")) {
+ version = paramMap.get("-version");
+ } else {
+ System.err.println("Invalid path parameter!");
+ printErrorHelp();
+ return;
+ }
+
+ // optional settings
+
+ if (paramMap.containsKey("-recursive")) {
+ recursive = Boolean.parseBoolean(paramMap.get("-recursive"));
+ }
+
+ System.out.printf("Initialized path=%s, version=%s recursive=%b\n", path, version, recursive);
+ final File folder = new File(path);
+
+ System.out.println("Scanning directories...");
+ scanAndUpdateFiles(folder);
+
+ } catch (Exception ex) {
+
+ System.err.println("Application crashed: " + ex.getMessage());
+ logger.log(Level.SEVERE, "Application crashed", ex);
+
+ }
+ }
+
+ private static void printErrorHelp() {
+ System.err.println("usage> java TargetFrameworkMigrator.jar -path= -version= -recursive=");
+ System.err.println("example> java TargetFrameworkMigrator.jar -path=C:\\test -version=v4.6.2 -recursive=true");
+ logger.severe("Invalid application parameter> " +
+ String.format("-path=%s, -version=%s, -recursive=%b -\n",
+ path, version, recursive));
+ }
+
+ private static void scanAndUpdateFiles(final File folder)
+ throws IOException, SAXException, ParserConfigurationException, XPathExpressionException, TransformerException {
+
+ File[] files = folder.listFiles();
+ if (files == null) return;
+
+ System.out.println(folder + ":");
+ for (final File fileEntry : files) {
+ if (fileEntry.isDirectory() && recursive) {
+ scanAndUpdateFiles(fileEntry);
+ } else if (fileEntry.isFile()) {
+ String file = fileEntry.getName();
+ if (getFileExtension(file).equals(".csproj")) {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ Document doc = builder.parse(fileEntry);
+ XPathFactory xPathfactory = XPathFactory.newInstance();
+ XPath xpath = xPathfactory.newXPath();
+ XPathExpression expr = xpath.compile("/Project/PropertyGroup/TargetFrameworkVersion/text()");
+ NodeList nodeList = (NodeList)expr.evaluate(doc, XPathConstants.NODESET);
+ if (nodeList.getLength() < 1) continue;
+ Node node = nodeList.item(0);
+ logger.info("Found: " + fileEntry.getAbsolutePath() + " version:" + node.getTextContent());
+ node.setTextContent(version);
+ Transformer xformer = TransformerFactory.newInstance().newTransformer();
+ xformer.transform(new DOMSource(doc), new StreamResult(new File(fileEntry.getAbsolutePath())));
+ logger.info("Changed: " + fileEntry.getAbsolutePath() + " version:" + node.getTextContent());
+ }
+ }
+ }
+ System.out.println();
+ }
+
+ private static String getFileExtension(String fileName) {
+ String extension = "";
+ int i = fileName.lastIndexOf('.');
+ if (i >= 0) {
+ extension = "." + fileName.substring(i + 1);
+ }
+ return extension;
+ }
+
+ private static void initLogger() {
+ logger = Logger.getLogger("TargetFrameworkMigrator");
+ FileHandler fh;
+ try {
+
+ // This block configure the logger with handler and formatter
+ fh = new FileHandler(LOGGER_FILE_NAME);
+ logger.addHandler(fh);
+ SimpleFormatter formatter = new SimpleFormatter();
+ fh.setFormatter(formatter);
+
+ } catch (SecurityException | IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+}