aggiunto componente x riorganizzare file librerie (PrettyBin) + test conf NLog
This commit is contained in:
@@ -7,16 +7,12 @@
|
||||
<add key="appName" value="MTConnect Adapter" />
|
||||
<!--gestione TIMERS e periodi multipli x thread lenti-->
|
||||
<add key="startTimerMs" value="250" />
|
||||
<add key="timerIntMs" value="5" />
|
||||
<!--invio da adapter ad agent: 5ms-->
|
||||
<add key="fastCount" value="20" />
|
||||
<!--100ms-->
|
||||
<add key="normCount" value="50" />
|
||||
<!--250ms-->
|
||||
<add key="slowCount" value="500" />
|
||||
<!--2.5 sec-->
|
||||
<add key="alarmSyncCount" value="6000" />
|
||||
<!--30 sec-->
|
||||
<add key="timerIntMs" value="5" /><!--invio da adapter ad agent: 5ms-->
|
||||
<add key="fastCount" value="20" /><!--100ms-->
|
||||
<add key="normCount" value="50" /><!--250ms-->
|
||||
<add key="slowCount" value="500" /><!--2.5 sec-->
|
||||
<add key="alarmSyncCount" value="6000" /><!--30 sec-->
|
||||
|
||||
<!--parametri gestione watchdog-->
|
||||
<add key="maxAdapterLockSec" value="5" />
|
||||
<!--AREA CONF IP FANUC-->
|
||||
@@ -84,4 +80,9 @@
|
||||
</providers>
|
||||
</roleManager>
|
||||
</system.web>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<probing privatePath="lib;libs" />
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
|
Before Width: | Height: | Size: 148 KiB After Width: | Height: | Size: 148 KiB |
@@ -48,7 +48,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>MTCA.ico</ApplicationIcon>
|
||||
<ApplicationIcon>DATA\CONF\MTCA.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'CMS-FANUC|AnyCPU' ">
|
||||
<OutputPath>bin\CMS-FANUC\</OutputPath>
|
||||
@@ -200,7 +200,7 @@
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Resources\SCM\SCM.ico" />
|
||||
<Content Include="MTCA.ico">
|
||||
<Content Include="DATA\CONF\MTCA.ico">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Resources\SCM\XSimGph.dll" />
|
||||
@@ -311,4 +311,10 @@
|
||||
<!--Publish copies the untransformed App.config to deployment directory so overwrite it-->
|
||||
<Copy Condition="Exists('$(DeployedConfig)')" SourceFiles="$(IntermediateOutputPath)$(TargetFileName).config" DestinationFiles="$(DeployedConfig)" />
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
<ItemGroup>
|
||||
<MoveToLibFolder Include="$(OutputPath)*.dll ; $(OutputPath)*.pdb ; $(OutputPath)*.xml" />
|
||||
</ItemGroup>
|
||||
<Move SourceFiles="@(MoveToLibFolder)" DestinationFolder="$(OutputPath)lib" OverwriteReadOnlyFiles="true" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -313,7 +313,7 @@ namespace MTC_Adapter
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.Format(@"{0}\MTCA.ico", Application.StartupPath);
|
||||
return string.Format(@"{0}\MTCA.ico", utils.confDir);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,41 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
|
||||
autoReload="true"
|
||||
throwExceptions="false"
|
||||
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
|
||||
throwExceptions="false">
|
||||
|
||||
<!-- optional, add some variables
|
||||
https://github.com/nlog/NLog/wiki/Configuration-file#variables
|
||||
-->
|
||||
<variable name="myvar" value="myvalue"/>
|
||||
<variable name="appName" value="MTC-Adapter" />
|
||||
|
||||
<!--
|
||||
See https://github.com/nlog/nlog/wiki/Configuration-file
|
||||
for information on customizing logging rules and outputs.
|
||||
-->
|
||||
<targets>
|
||||
<targets async="true">
|
||||
<target xsi:type="File"
|
||||
name="default"
|
||||
layout="${longdate} - ${level:uppercase=true}: ${message}${onexception:${newline}EXCEPTION\: ${exception:format=ToString}}"
|
||||
fileName="${specialfolder:ApplicationData}\${appName}\Debug.log"
|
||||
keepFileOpen="false"
|
||||
archiveFileName="${specialfolder:ApplicationData}\${appName}\Debug_${shortdate}.{##}.log"
|
||||
archiveNumbering="Sequence"
|
||||
archiveEvery="Day"
|
||||
maxArchiveFiles="30"
|
||||
/>
|
||||
|
||||
<!--
|
||||
add your targets here
|
||||
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
|
||||
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
|
||||
-->
|
||||
|
||||
<!--
|
||||
Write events to a file with the date in the filename.
|
||||
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
|
||||
layout="${longdate} ${uppercase:${level}} ${message}" />
|
||||
-->
|
||||
<target xsi:type="EventLog"
|
||||
name="eventlog"
|
||||
source="${appName}"
|
||||
layout="${message}${newline}${exception:format=ToString}"/>
|
||||
</targets>
|
||||
|
||||
<rules>
|
||||
<!-- add your logging rules here -->
|
||||
|
||||
<!--
|
||||
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
|
||||
<logger name="*" minlevel="Debug" writeTo="f" />
|
||||
-->
|
||||
<logger name="*" writeTo="default" minlevel="Info" />
|
||||
<logger name="*" writeTo="eventlog" minlevel="Error" />
|
||||
</rules>
|
||||
</nlog>
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace MTC_Adapter
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.Format(@"{0}\MTCA.ico", Application.StartupPath);
|
||||
return string.Format(@"{0}\MTCA.ico", utils.confDir);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
|
||||
@@ -3,4 +3,5 @@
|
||||
<package id="NLog" version="4.3.11" targetFramework="net452" />
|
||||
<package id="NLog.Config" version="4.3.11" targetFramework="net452" />
|
||||
<package id="NLog.Schema" version="4.3.11" targetFramework="net452" />
|
||||
<package id="PrettyBin" version="1.1.0" targetFramework="net452" />
|
||||
</packages>
|
||||
@@ -22,26 +22,26 @@ goto END
|
||||
|
||||
:CMS
|
||||
echo CMS: copio files CMS - Zogno
|
||||
del %2"MTCA.ico"
|
||||
del %2"DATA\CONF\MTCA.ico"
|
||||
del %2"DATA\CONF\Adapter_ItemList.xml"
|
||||
del %2"DATA\CONF\AlarmList.map"
|
||||
del %2"DATA\CONF\EsaKvara.ini"
|
||||
del %2"DATA\CONF\SCM_prodFile.pro"
|
||||
REM del /F /Q %2"DATA\CONF\*.*"
|
||||
copy %2"Resources\CMS\CMS.ico" %2"MTCA.ico"
|
||||
copy %2"Resources\CMS\CMS.ico" %2"DATA\CONF\MTCA.ico"
|
||||
REM ora verifico tipo controllo esatto...
|
||||
if %1 == "CMS-FANUC" goto FANUC
|
||||
if %1 == "CMS-SIEMENS" goto SIEMENS
|
||||
|
||||
:SCM
|
||||
echo SCM: copio files SCM - Rimini
|
||||
del %2"MTCA.ico"
|
||||
del %2"DATA\CONF\MTCA.ico"
|
||||
del %2"DATA\CONF\Adapter_ItemList.xml"
|
||||
del %2"DATA\CONF\AlarmList.map"
|
||||
del %2"DATA\CONF\EsaKvara.ini"
|
||||
del %2"DATA\CONF\SCM_prodFile.pro"
|
||||
REM del /F /Q %2"DATA\CONF\*.*"
|
||||
copy %2"Resources\SCM\SCM.ico" %2"MTCA.ico"
|
||||
copy %2"Resources\SCM\SCM.ico" %2"DATA\CONF\MTCA.ico"
|
||||
copy %2"Resources\SCM\SCM_ESA.xml" %2"DATA\CONF\Adapter_ItemList.xml"
|
||||
copy %2"Resources\SCM\AlarmListEsaGv.map" %2"DATA\CONF\AlarmList.map"
|
||||
copy %2"Resources\SCM\EsaKvara.ini" %2"DATA\CONF\EsaKvara.ini"
|
||||
|
||||
Binary file not shown.
+14
@@ -0,0 +1,14 @@
|
||||
PrettyBin
|
||||
=========
|
||||
|
||||
Make bin folder of your project small, pretty and easy to maintain!
|
||||
|
||||
Moves dll,pdb and xml in bin/lib subfolder and ensures, that everything works.
|
||||
|
||||
Your bin folder will look like this:
|
||||
|
||||
/lib
|
||||
|
||||
app.exe
|
||||
|
||||
app.config
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
|
||||
<!--
|
||||
<runtime xdt:Transform="InsertIfMissing">
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"
|
||||
xdt:Transform="InsertIfMissing">
|
||||
|
||||
<probing xdt:Transform="InsertIfMissing"
|
||||
privatePath="lib;libs" />
|
||||
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
-->
|
||||
</configuration>
|
||||
@@ -0,0 +1,7 @@
|
||||
Copyright (c) 2014, Ershov Andrey
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -0,0 +1,2 @@
|
||||
del PrettyBin.*.*.*.nupkg
|
||||
nuget.exe pack PrettyBin.nuspec
|
||||
@@ -0,0 +1,3 @@
|
||||
param($installPath, $toolsPath, $package, $project)
|
||||
|
||||
Write-Host 'Init BinPrettify'
|
||||
@@ -0,0 +1,156 @@
|
||||
param($installPath, $toolsPath, $package, $project)
|
||||
|
||||
|
||||
$path = $project.FullName
|
||||
|
||||
$appConfigItem = $project.ProjectItems | where {$_.Name -eq "App.config"}
|
||||
if ($appConfigItem -eq $null)
|
||||
{
|
||||
throw [System.IO.FileNotFoundException] "Project $path does not have App.config. PrettyBin is for exetutable projects only. "
|
||||
}
|
||||
|
||||
Write-Host 'Install PrettifyBin; '
|
||||
[xml]$doc = [xml](Get-Content $path)
|
||||
|
||||
|
||||
# If a Namespace URI was not given, use the Xml document's default namespace.
|
||||
$NamespaceURI = $doc.DocumentElement.NamespaceURI
|
||||
Write-Host $NamespaceURI
|
||||
# In order for SelectSingleNode() to actually work, we need to use the fully qualified node path along with an Xml Namespace Manager, so set them up.
|
||||
$xmlNsManager = New-Object System.Xml.XmlNamespaceManager($doc.NameTable)
|
||||
$xmlNsManager.AddNamespace("ns", $NamespaceURI)
|
||||
|
||||
|
||||
# ============ This script attemps to Create this tags in csproj: ========
|
||||
#
|
||||
# <Target Name="AfterBuild">
|
||||
# <ItemGroup>
|
||||
# <MoveToLibFolder Include="$(OutputPath)*.dll ; $(OutputPath)*.pdb ; $(OutputPath)*.xml" />
|
||||
# </ItemGroup>
|
||||
# <Move SourceFiles="@(MoveToLibFolder)" DestinationFolder="$(OutputPath)lib" OverwriteReadOnlyFiles="true" />
|
||||
# </Target>
|
||||
|
||||
|
||||
|
||||
|
||||
$targetNode = $doc.SelectSingleNode("//ns:Project/ns:Target[@Name='AfterBuild']", $xmlNsManager)
|
||||
|
||||
if ($targetNode -eq $null)
|
||||
{
|
||||
Write-Host 'No Target AfterBuild Node. Creating'
|
||||
$targetNode = $doc.CreateElement('Target', $NamespaceURI )
|
||||
$targetNode.SetAttribute("Name" ,"AfterBuild")
|
||||
$doc.Project.AppendChild($targetNode)
|
||||
}
|
||||
|
||||
|
||||
$filesToMoveNode = $targetNode.SelectSingleNode("//ns:ItemGroup/ns:MoveToLibFolder", $xmlNsManager)
|
||||
|
||||
if ($filesToMoveNode -eq $null)
|
||||
{
|
||||
Write-Host 'No ItemGroup whith MoveToLibFolder tag. Creating'
|
||||
$itemGroup = $doc.CreateElement('ItemGroup', $NamespaceURI)
|
||||
$filesToMoveNode = $doc.CreateElement('MoveToLibFolder', $NamespaceURI)
|
||||
|
||||
$itemGroup.AppendChild($filesToMoveNode)
|
||||
$targetNode.AppendChild($itemGroup)
|
||||
}
|
||||
|
||||
$filesToMoveNode.SetAttribute("Include" ,'$(OutputPath)*.dll ; $(OutputPath)*.pdb ; $(OutputPath)*.xml')
|
||||
|
||||
|
||||
$MoveNode = $targetNode.SelectSingleNode('//ns:Move[contains(@SourceFiles,"@(MoveToLibFolder)")]', $xmlNsManager)
|
||||
if ($MoveNode -eq $null)
|
||||
{
|
||||
Write-Host 'No Move tag in AfterBuild Target. Creating'
|
||||
$MoveNode = $doc.CreateElement('Move', $NamespaceURI)
|
||||
$MoveNode.SetAttribute("SourceFiles" ,'@(MoveToLibFolder)')
|
||||
$targetNode.AppendChild($MoveNode)
|
||||
}
|
||||
$MoveNode.SetAttribute("DestinationFolder",'$(OutputPath)lib')
|
||||
$MoveNode.SetAttribute("OverwriteReadOnlyFiles","true")
|
||||
|
||||
$doc.Save($path)
|
||||
|
||||
# ============ This script attemps to Edit this tags in App.config: ========
|
||||
#
|
||||
# <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
|
||||
# <runtime>
|
||||
# <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
# <probing privatePath="lib;libs" />
|
||||
# </assemblyBinding>
|
||||
# </runtime>
|
||||
# </configuration>
|
||||
|
||||
Write-Host 'Edititing App.config'
|
||||
# find the App.config file
|
||||
$configItem = $project.ProjectItems | where {$_.Name -eq "App.config"}
|
||||
# find its path on the file system
|
||||
$configPath= $configItem.Properties | where {$_.Name -eq "LocalPath"}
|
||||
|
||||
# Get XML content of App.config
|
||||
[xml]$app = [xml](Get-Content $configPath.Value)
|
||||
|
||||
# If a Namespace URI was not given, use the Xml document's default namespace.
|
||||
$NamespaceAppURI = $app.DocumentElement.NamespaceURI
|
||||
# In order for SelectSingleNode() to actually work, we need to use the fully qualified node path along with an Xml Namespace Manager, so set them up.
|
||||
$xmlNsManager.AddNamespace("appns", $NamespaceAppURI)
|
||||
|
||||
# Adding of configuration section
|
||||
$configurationNode = $app.SelectSingleNode("//appns:configuration", $xmlNsManager)
|
||||
|
||||
if ($configurationNode -eq $null)
|
||||
{
|
||||
Write-Host 'No Configuration Node. Creating'
|
||||
# Для чего тут нужен NamespaceURI
|
||||
$configurationNode = $app.CreateElement('Configuration', $NamespaceAppURI )
|
||||
$configurationNode.SetAttribute("xmlns:xdt" ,"http://schemas.microsoft.com/XML-Document-Transform")
|
||||
$app.AppendChild($configurationNode)
|
||||
}
|
||||
|
||||
# Adding of runtime section
|
||||
$runtimeNode = $configurationNode.SelectSingleNode("//appns:runtime", $xmlNsManager)
|
||||
|
||||
if ($runtimeNode -eq $null)
|
||||
{
|
||||
Write-Host 'No runtime Node. Creating'
|
||||
$runtimeNode = $app.CreateElement('runtime', $NamespaceAppURI )
|
||||
$configurationNode.AppendChild($runtimeNode)
|
||||
}
|
||||
|
||||
# Adding of assemblyBinding section
|
||||
Write-Host 'runtimeNode items'
|
||||
$assemblyBindingNode = $null
|
||||
foreach ($item in $runtimeNode.ChildNodes)
|
||||
{
|
||||
if ($item.Name -eq 'assemblyBinding')
|
||||
{
|
||||
$assemblyBindingNode = $item
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
#$assemblyBindingNode = $runtimeNode.SelectSingleNode("//appns:assemblyBinding", $xmlNsManager)
|
||||
|
||||
if ($assemblyBindingNode -eq $null)
|
||||
{
|
||||
Write-Host 'No assemblyBinding Node. Creating'
|
||||
$assemblyBindingNode = $app.CreateElement('assemblyBinding', $NamespaceAppURI )
|
||||
$runtimeNode.AppendChild($assemblyBindingNode)
|
||||
}
|
||||
$assemblyBindingNode.SetAttribute("xmlns" ,"urn:schemas-microsoft-com:asm.v1")
|
||||
|
||||
# Adding of probing section
|
||||
$probingNode = $assemblyBindingNode.SelectSingleNode("//appns:probing", $xmlNsManager)
|
||||
|
||||
if ($probingNode -eq $null)
|
||||
{
|
||||
Write-Host 'No probing Node. Creating'
|
||||
$probingNode = $app.CreateElement('probing', $NamespaceAppURI )
|
||||
$assemblyBindingNode.AppendChild($probingNode)
|
||||
}
|
||||
$probingNode.SetAttribute("privatePath" ,"lib;libs")
|
||||
|
||||
$app.save($configPath.Value)
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
param($installPath, $toolsPath, $package, $project)
|
||||
|
||||
|
||||
Try
|
||||
{
|
||||
$path = $project.FullName
|
||||
Write-Host 'Uninstall PrettifyBin; '
|
||||
[ xml ]$doc = [ xml ](Get-Content $path)
|
||||
|
||||
|
||||
# If a Namespace URI was not given, use the Xml document's default namespace.
|
||||
$NamespaceURI = $doc.DocumentElement.NamespaceURI
|
||||
Write-Host $NamespaceURI
|
||||
# In order for SelectSingleNode() to actually work, we need to use the fully qualified node path along with an Xml Namespace Manager, so set them up.
|
||||
$xmlNsManager = New-Object System.Xml.XmlNamespaceManager($doc.NameTable)
|
||||
$xmlNsManager.AddNamespace("ns", $NamespaceURI)
|
||||
|
||||
|
||||
# ============ This script attemps to remove this tags in csproj: ========
|
||||
#
|
||||
# <Target Name="AfterBuild">
|
||||
# <Move SourceFiles="@(MoveToLibFolder)" DestinationFolder="$(OutputPath)lib" OverwriteReadOnlyFiles="true" />
|
||||
# </Target>
|
||||
|
||||
|
||||
$moveNode = $doc.SelectSingleNode("//ns:Project/ns:Target[@Name='AfterBuild']/ns:Move[contains(@SourceFiles,'@(MoveToLibFolder)')]", $xmlNsManager)
|
||||
|
||||
if ($moveNode -ne $null)
|
||||
{
|
||||
Write-Host 'We will delete move node'
|
||||
$moveNode.ParentNode.RemoveChild($moveNode)
|
||||
}
|
||||
|
||||
|
||||
$doc.Save($path)
|
||||
}
|
||||
Catch
|
||||
{
|
||||
$ErrorMessage = $_.Exception.Message
|
||||
$FailedItem = $_.Exception.ItemName
|
||||
Write-Host $ErrorMessage
|
||||
Write-Host $FailedItem
|
||||
Break
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user