I am making an api and I want to read from the web.config an integer value. I tried to do it like this:
<applicationSettings>
<HHH.Properties.Settings>
<setting name="loggerPath" serializeAs="String">
<value>Logs</value>
</setting>
<setting name="querytime" serializeAs="String">
<value>30</value>
</setting>
<setting name="windowstime" serializeAs="String">
<value>86400</value>
</setting>
<setting name="alarmarmingtime" serializeAs="String">
<value>300</value>
</setting>
</HHH.Properties.Settings>
</applicationSettings>
The value I want to read is the windowstime but it throws me an error.
In the serializeAs property I cannot choose "integer" for example because it is an enumerated one and it does not have this option. How should I do it?
I already resolved it. I used this:
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="windowstime" value="86400"/>
</appSettings>
Related
I have two projects:
The first one (VTB_Terminliste) was build as a class library (.dll) with Entity Framework.
The second one is the main application, which include VTB_Terminliste as .dll, which I want to show after click button, like:
Private Sub btnTerminliste_Click(sender As Object, e As EventArgs) Handles btnTerminliste.Click
Dim l As New VTB_Terminliste.MainView
l.Show()
End Sub
In my App.Config from main application I insert the connection string for my Entites
<add name="ATX_PLSNGEntities" connectionString="metadata=res://*/DBA_Terminliste.csdl|res://*/DBA_Terminliste.ssdl|res://*/DBA_Terminliste.msl;provider=System.Data.SqlClient;provider connection string="data source=atx-srv-58;initial catalog=ATX_PLSNG;persist security info=True;user id=SomeUser;password=SomePW;MultipleActiveResultSets=True;App=EntityFramework""
providerName="System.Data.EntityClient" />
After start and click the button btnTerminliste I get an error "No connection string named 'ATX_PLSNGEntities' could be found in the application config file"
If I start VTB_Terminliste project as WinForm every thing is working.
Here are my App.Config from project VTB_Terminliste and the main application
VTB_Terminliste
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System">
<section name="DevExpress.LookAndFeel.Design.AppSettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<applicationSettings>
<DevExpress.LookAndFeel.Design.AppSettings>
<setting name="DefaultAppSkin" serializeAs="String">
<value>Skin/The Bezier</value>
</setting>
<setting name="DefaultPalette" serializeAs="String">
<value>Gloom Gloom</value>
</setting>
<setting name="TouchUI" serializeAs="String">
<value></value>
</setting>
<setting name="TouchScaleFactor" serializeAs="String">
<value></value>
</setting>
<setting name="DirectX" serializeAs="String">
<value>True</value>
</setting>
<setting name="RegisterUserSkins" serializeAs="String">
<value></value>
</setting>
<setting name="FontBehavior" serializeAs="String">
<value></value>
</setting>
<setting name="DefaultAppFont" serializeAs="String">
<value></value>
</setting>
<setting name="DPIAwarenessMode" serializeAs="String">
<value>System</value>
</setting>
</DevExpress.LookAndFeel.Design.AppSettings>
</applicationSettings>
<system.diagnostics>
<sources>
<!-- Dieser Abschnitt definiert die Protokollierungskonfiguration für My.Application.Log -->
<source name="DefaultSource" switchName="DefaultSwitch">
<listeners>
<add name="FileLog" />
<!-- Auskommentierung des nachfolgenden Abschnitts aufheben, um in das Anwendungsereignisprotokoll zu schreiben -->
<!--<add name="EventLog"/>-->
</listeners>
</source>
</sources>
<switches>
<add name="DefaultSwitch" value="Information" />
</switches>
<sharedListeners>
<add name="FileLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" initializeData="FileLogWriter" />
<!-- Auskommentierung des nachfolgenden Abschnitts aufheben und APPLICATION_NAME durch den Namen der Anwendung ersetzen, um in das Anwendungsereignisprotokoll zu schreiben -->
<!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
</sharedListeners>
</system.diagnostics>
<connectionStrings>
<add name="ATX_PLSNGEntities" connectionString="metadata=res://*/DBA_Terminliste.csdl|res://*/DBA_Terminliste.ssdl|res://*/DBA_Terminliste.msl;provider=System.Data.SqlClient;provider connection string="data source=atx-srv-58;initial catalog=ATX_PLSNG;persist security info=True;user id=SomeUser;password=SomePW;MultipleActiveResultSets=True;App=EntityFramework""
providerName="System.Data.EntityClient" />
</connectionStrings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>
Main application
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="ATX_DBA_Test_Connection" connectionString="XpoProvider=MSSqlServer;data source=atx-srv-28;user id=sa;password=Zu3545Uz;initial catalog=ATX_DBA_Test;Persist Security Info=true" />
<add name="ATX_PLSNGEntities" connectionString="metadata=res://*/DBA_Terminliste.csdl|res://*/DBA_Terminliste.ssdl|res://*/DBA_Terminliste.msl;provider=System.Data.SqlClient;provider connection string="data source=atx-srv-58;initial catalog=ATX_PLSNG;persist security info=True;user id=SomeUser;password=SomePW;MultipleActiveResultSets=True;App=EntityFramework""
providerName="System.Data.EntityClient" />
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>
I hope someone can help find me a solution.
I solve my problem adding the connection string inside .Context.vb
Partial Public Class ATX_PLSNGEntities
Inherits DbContext
Public Sub New()
MyBase.New("metadata=res://*/DBA_Terminliste.csdl|res://*/DBA_Terminliste.ssdl|res://*/DBA_Terminliste.msl;provider=System.Data.SqlClient;provider connection string='data source=SomeServer;initial catalog=ATX_PLSNG;persist security info=True;user id=SomeUser;password=SomePW;MultipleActiveResultSets=True;App=EntityFramework'")
End Sub
Protected Overrides Sub OnModelCreating(modelBuilder As DbModelBuilder)
Throw New UnintentionalCodeFirstException()
End Sub
Public Overridable Property Terminliste() As DbSet(Of Terminliste)
End Class
I have upgraded my web service project from vs 2005 to 2012. My webservice uses a project to log status in event viewer, which inturn uses enterprise library 2.0. Now that i have upgraded, i changed all my configs and dlls to newer version but while debugging i get this following exception.
{"Activation error occurred while trying to get instance of type LogWriter, key """}
InnerException:
{"Resolution of the dependency failed, type = "Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter", name = "(none)".
Exception occurred while: while resolving.
Exception is: InvalidOperationException - The type LogWriter cannot be constructed. You must configure the container to supply this value.
At the time of the exception, the container was:
Resolving Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter,(none)
"}
StackTrace :
at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable1 resolverOverrides)
at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, String name, IEnumerable1 resolverOverrides)
at Microsoft.Practices.Unity.UnityContainer.Resolve(Type t, String name, ResolverOverride[] resolverOverrides)
at Microsoft.Practices.Unity.UnityServiceLocator.DoGetInstance(Type serviceType, String key)
at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key)
Could you please help me out with this, as i ve been working on this issue for 3 days now with no luck.
app.config:
<configuration>
<configSections>
<section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<section name="EnService.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" requirePermission="false" />
</sectionGroup>
</configSections>
<loggingConfiguration name="Logging Application Block" tracingEnabled="true"
defaultCategory="General" logWarningsWhenNoCategoriesMatch="true">
<listeners>
<add source="EnService" formatter="Text Formatter" log="MPASLog"
machineName="" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</listeners>
<formatters>
<add template="Timestamp: {timestamp}
Message: {message}
Category: {category}
Priority: {priority}
EventId: {eventid}
Severity: {severity}
Title:{title}
Machine: {machine}
Application Domain: {appDomain}
Process Id: {processId}
Process Name: {processName}
Win32 Thread Id: {win32ThreadId}
Thread Name: {threadName}
Extended Properties: {dictionary({key} - {value}
)}"
type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="Text Formatter" />
</formatters>
<categorySources>
<add switchValue="All" name="General">
<listeners>
<add name="Formatted EventLog TraceListener" />
</listeners>
</add>
</categorySources>
<specialSources>
<allEvents switchValue="All" name="All Events" />
<notProcessed switchValue="All" name="Unprocessed Category" />
<errors switchValue="All" name="Logging Errors & Warnings">
<listeners>
<add name="Formatted EventLog TraceListener" />
</listeners>
</errors>
</specialSources>
</loggingConfiguration>
<system.diagnostics>
<sources>
<!-- This section defines the logging configuration for My.Application.Log -->
<source name="DefaultSource" switchName="DefaultSwitch">
<listeners>
<add name="FileLog" />
<!-- Uncomment the below section to write to the Application Event Log -->
<!--<add name="EventLog"/>-->
</listeners>
</source>
</sources>
<switches>
<add name="DefaultSwitch" value="Information" />
</switches>
<sharedListeners>
<add name="FileLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" initializeData="FileLogWriter" />
<!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
<!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
</sharedListeners>
</system.diagnostics>
<applicationSettings>
<EnService.My.MySettings>
<setting name="CONST_PRINT_LOG" serializeAs="String">
<value>1</value>
</setting>
<setting name="CONST_JOB_STATUS_SUCCESS" serializeAs="String">
<value>1</value>
</setting>
<setting name="CONST_WEB_SERVICE_TIME_OUT" serializeAs="String">
<value>10800000</value>
</setting>
<setting name="Seperater" serializeAs="String">
<value>.</value>
</setting>
<setting name="EnService_EnServiceWebReference_EnServiceService" serializeAs="String">
<value>http://localhost/EnServiceService.asmx</value>
</setting>
<setting name="PrintFolder" serializeAs="String">
<value>C:\Jobs\PrintDocuments\</value>
</setting>
<setting name="ResultLocation" serializeAs="String">
<value>C:\Jobs\EnService\Result</value>
</setting>
<setting name="ArchiveFilePrefix" serializeAs="String">
<value>EnService_Report_</value>
</setting>
<setting name="ExceptionArchiveFilePrefix" serializeAs="String">
<value>EnService_Exception_Report_</value>
</setting>
<setting name="CONST_PRINT_REPORT" serializeAs="String">
<value>X</value>
</setting>
<setting name="ReportArchiveLocation" serializeAs="String">
<value>C:\Jobs\EnService\OUT</value>
</setting>
<setting name="CommonWebServiceURL" serializeAs="String">
<value>http://localhost/WebService/Service.asmx</value>
</setting>
</EnService.My.MySettings>
</applicationSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup>
</configuration>
Appreciate your help,
Vinay
I was using logger.write() in my application
When i added
" Logger.SetLogWriter(New LogWriterFactory().Create(), False) "`
My application worked fine.
I have a pretty simple WCF service set up to run in an Azure web role. It's not working quite right (expectedly), but I need to gather trace diagnostics to debug successfully. Could someone identify where I've gone wrong?
Here is my web.config for the web role:
<?xml version="1.0"?>
<configuration>
<configSections>
</configSections>
<!-- To collect diagnostic traces, uncomment the section below or merge with existing system.diagnostics section.
To persist the traces to storage, update the DiagnosticsConnectionString setting with your storage credentials.
To avoid performance degradation, remember to disable tracing on production deployments. -->
<system.diagnostics>
<sources>
<source propagateActivity="true" name="System.ServiceModel" switchValue="Verbose,ActivityTracing">
<listeners>
<add name="AzureLocalStorage">
<filter type="" />
</add>
</listeners>
</source>
<source name="System.ServiceModel.MessageLogging" switchValue="Verbose">
<listeners>
<add name="AzureLocalStorage">
<filter type="" />
</add>
</listeners>
</source>
</sources>
<trace>
<listeners>
<add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="AzureDiagnostics">
<filter type="" />
</add>
</listeners>
</trace>
<sharedListeners>
<add name="AzureLocalStorage" type="MyApp.Svc.AzureLocalStorageTraceListener, MyApp.Svc" />
</sharedListeners>
</system.diagnostics>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<customErrors mode="Off" />
</system.web>
<system.serviceModel>
<diagnostics>
<messageLogging logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" />
<endToEndTracing activityTracing="true" messageFlowTracing="true" />
</diagnostics>
<services>
<service name="MyApp.Svc.Tracker">
<endpoint address="" behaviorConfiguration="restJsonBehavior"
binding="webHttpBinding" bindingConfiguration="" name="restEndpoint"
contract="Cogent.TimeTracker.Azure.Svc.ITracker" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="restJsonBehavior">
<webHttp helpEnabled="true" defaultOutgoingResponseFormat="Json" />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<rewrite>
<rules>
<rule name="TrackerService" stopProcessing="true">
<match url="^tracker/(.*)$"/>
<action type="Rewrite" url="Tracker.svc/{R:1}"/>
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
I just keep staring at this, thinking to myself: "I can't find anything wrong with this!". Here's my ServiceDefinition.csdef:
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="MyApp" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
<WebRole name="MyApp.Svc" vmsize="Small">
<Sites>
<Site name="Web">
<Bindings>
<Binding name="Endpoint1" endpointName="Endpoint1" />
</Bindings>
</Site>
</Sites>
<Endpoints>
<InputEndpoint name="Endpoint1" protocol="http" port="80" />
</Endpoints>
<Imports>
<Import moduleName="Diagnostics" />
<Import moduleName="Connect" />
</Imports>
<LocalResources>
<LocalStorage name="MyApp.Svc.svclog" sizeInMB="1000" cleanOnRoleRecycle="true" />
</LocalResources>
<Startup>
<Task commandLine="installStuff.cmd" executionContext="elevated">
<Environment>
<Variable name="EMULATED">
<RoleInstanceValue xpath="/RoleEnvironment/Deployment/#emulated" />
</Variable>
</Environment>
</Task>
</Startup>
</WebRole>
</ServiceDefinition>
and finally, my ServiceConfiguration.Cloud.cscfg:
<?xml version="1.0" encoding="utf-8"?>
<ServiceConfiguration serviceName="MyApp" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="1" osVersion="*">
<Role name="MyApp.Svc">
<Instances count="1" />
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="DefaultEndpointsProtocol=https;AccountName=myaccountname;AccountKey=myaccountkey" />
<Setting name="Microsoft.WindowsAzure.Plugins.Connect.ActivationToken" value="myactivationtoken" />
<Setting name="Microsoft.WindowsAzure.Plugins.Connect.Refresh" value="" />
<Setting name="Microsoft.WindowsAzure.Plugins.Connect.WaitForConnectivity" value="" />
<Setting name="Microsoft.WindowsAzure.Plugins.Connect.Upgrade" value="" />
<Setting name="Microsoft.WindowsAzure.Plugins.Connect.EnableDomainJoin" value="" />
<Setting name="Microsoft.WindowsAzure.Plugins.Connect.DomainFQDN" value="" />
<Setting name="Microsoft.WindowsAzure.Plugins.Connect.DomainControllerFQDN" value="" />
<Setting name="Microsoft.WindowsAzure.Plugins.Connect.DomainAccountName" value="" />
<Setting name="Microsoft.WindowsAzure.Plugins.Connect.DomainPassword" value="" />
<Setting name="Microsoft.WindowsAzure.Plugins.Connect.DomainOU" value="" />
<Setting name="Microsoft.WindowsAzure.Plugins.Connect.Administrators" value="" />
<Setting name="Microsoft.WindowsAzure.Plugins.Connect.DomainSiteName" value="" />
</ConfigurationSettings>
</Role>
</ServiceConfiguration>
Update: and also my WebRole.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.Diagnostics;
using Microsoft.WindowsAzure.ServiceRuntime;
using System.Diagnostics;
namespace MyApp.Svc
{
public class WebRole : RoleEntryPoint
{
public override bool OnStart()
{
// To enable the AzureLocalStorageTraceListner, uncomment relevent section in the web.config
DiagnosticMonitorConfiguration diagnosticConfig = DiagnosticMonitor.GetDefaultInitialConfiguration();
diagnosticConfig.Directories.ScheduledTransferPeriod = TimeSpan.FromMinutes(1);
diagnosticConfig.Directories.DataSources.Add(AzureLocalStorageTraceListener.GetLogDirectory());
DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", diagnosticConfig);
// For information on handling configuration changes
// see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.
Trace.WriteLine("MyApp.Svc started", "Information");
return base.OnStart();
}
}
}
It seems we cannot spot any major issue in the configuration. But please make sure you’re using the correct type:
type="MyApp.Svc.AzureLocalStorageTraceListener, MyApp.Svc"
Check if it is correct. Actually you can also remove the type. I would like to suggest you to check http://blogs.msdn.com/b/myazureworld/archive/2011/07/20/wcf-tracing-in-windows-azure-sdk-1-3-or-higher.aspx for a sample.
If it doesn’t help, please try to use remote desktop to connect to the server to see whether there is any traces in local storage.
Best Regards,
Ming Xu.
Actually, I think it turns out that this configuration was working fine, I just wasn't being patient enough for the DiagnosticMonitor to write out to the blob.
Right now I have to specify connection strings for active record/nhibernate in my config file like so:
<activerecord>
<config type="Navtrak.Business.Schemas.CommonSchemas.Models.NavtrakOperations.NavtrakOperationsDatabase`1, CommonSchemas">
<add key="connection.connection_string" value="connstring1" />
<add key="connection.driver_class" value="NHibernate.Driver.SqlClientDriver" />
<add key="dialect" value="NHibernate.Dialect.MsSql2005Dialect" />
<add key="connection.provider" value="NHibernate.Connection.DriverConnectionProvider" />
<add key="show_sql" value="true" />
<add key="proxyfactory.factory_class" value="NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle" />
</config>
<config type="Navtrak.Business.Schemas.CommonSchemas.Models.Users.UsersDatabase`1, CommonSchemas">
<add key="connection.connection_string" value="connstring2" />
<add key="connection.driver_class" value="NHibernate.Driver.SqlClientDriver" />
<add key="dialect" value="NHibernate.Dialect.MsSql2005Dialect" />
<add key="connection.provider" value="NHibernate.Connection.DriverConnectionProvider" />
<add key="show_sql" value="true" />
<add key="proxyfactory.factory_class" value="NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle" />
</config>
</activerecord>
Then I initialize active record:
if (!ActiveRecordStarter.IsInitialized)
ActiveRecordStarter.Initialize(typeof(SimpleModel).Assembly, ActiveRecordSectionHandler.Instance);
These connection strings must be database-driven so I need a way to programmatically set them. How can I do so? Keep in mind that I connect to multiple databases, in case that makes a difference...
Use InPlaceConfigurationSource. Some examples:
http://www.castleproject.org/activerecord/documentation/trunk/usersguide/configref.html#InPlaceConfigurationSource
http://www.darkside.co.za/archive/2007/09/06/three-ways-to-configure-castle-activerecord.aspx
http://geekswithblogs.net/hammett/articles/76809.aspx
http://code.google.com/p/mausch/source/browse/trunk/LazyTests/FirebirdTests.cs?spec=svn359&r=334#22
http://www.mail-archive.com/castle-project-users#googlegroups.com/msg04503.html
I'm trying to use XmlMassUpdate to update my config files based on build Version type. There seems to be no documentation on how to update the new app.config (vs2008) settings formats anywhere.
This is the config section:
<applicationSettings>
<CTC.Mica.ClientService.Properties.Settings>
<setting name="PipeName" serializeAs="String">
<value>\\.\pipe\micaPipe</value>
</setting>
<setting name="CTC_Mica_ClientService_MicaWebService_MicaWebService"
serializeAs="String">
<value>URL</value>
</setting>
</CTC.Mica.ClientService.Properties.Settings>
</applicationSettings>
And i am trying to update the URL value from this file:
<Debug>
<setting xmu:key="name" name="CTC_Mica_ClientService_MicaWebService_MicaWebService" serializeAs="String">
<value>DEVURL</value>
</setting>
</Debug>
<Test>
<setting xmu:key="name" name="CTC_Mica_ClientService_MicaWebService_MicaWebService" serializeAs="String">
<value>TESTURL</value>
</setting>
</Test>
<Release>
<setting xmu:key="name" name="CTC_Mica_ClientService_MicaWebService_MicaWebService" serializeAs="String">
<value>LIVEURL</value>
</setting>
</Release>
Running the script, i can replace either the "name" or the "serializeAs" attributes, but not the value node.
How would i go about replacing the value node?
Regards
Tris
The following scripts work fine for me (running on 1.3.0.471 which might be a nightly build):
build.proj
<Project DefaultTargets="Run" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.targets" />
<Target Name="Run">
<Delete Condition="Exists('output.xml')" Files="output.xml"/>
<XmlMassUpdate
ContentFile="input.xml"
ContentRoot="/test"
SubstitutionsFile="subs.xml"
SubstitutionsRoot="/substitutions/release"
MergedFile="output.xml"
/>
</Target>
</Project>
input.xml
<test>
<setting name="PipeName" serializeAs="String">
<value>\\.\pipe\micaPipe</value>
</setting>
<setting name="CTC_Mica_ClientService_MicaWebService_MicaWebService" serializeAs="String">
<value>URL</value>
</setting>
</test>
subs.xml
<substitutions xmlns:xmu="urn:msbuildcommunitytasks-xmlmassupdate">
<release>
<setting xmu:key="name" name="CTC_Mica_ClientService_MicaWebService_MicaWebService" serializeAs="Testing">
<value>LIVEURL</value>
</setting>
</release>
</substitutions>
output.xml (generated by build)
<test>
<setting name="PipeName" serializeAs="String">
<value>\\.\pipe\micaPipe</value>
</setting>
<setting name="CTC_Mica_ClientService_MicaWebService_MicaWebService" serializeAs="Testing">
<value>LIVEURL</value>
</setting>
</test>