I'm trying to improve our workflow with some XML-configuration files we use in a Visual Studio Solution. I figured I'll start with explaining what I'm trying to accomplish and then explain some of my ideas that I've tried for several hours without success.
The Problem
I'm working with a system where the data model is configured in a database, the models are also stored on disk using xml-files, these are then synced during startup of the app. Here's part of the stuff that are synced:
Data Types
All data types lives in one XML configuration file per data type and each has some properties like Name and Key. All data types are configured in the same folder, example: /config/dataTypes
Example
textString.config
<?xml version="1.0" encoding="UTF-8" ?>
<DataType Key="a45c9a94-09d7-4df9-85e6-d6930abc6c12" Name="Textstring">
textArea.config
<?xml version="1.0" encoding="UTF-8" ?>
<DataType Key="b104788f-4e2f-4592-9387-8b3861bd8046" Name="Textarea">
Entity Types
Think of these as models with X number of properties, each property is configured and connected to a Data Type.
Example
customer.config
<?xml version="1.0" encoding="UTF-8" ?>
<Entity>
<Properties>
<Property Name="Firstname" TypeKey="a45c9a94-09d7-4df9-85e6-d6930abc6c12" />
<Property Name="Lastname" TypeKey="a45c9a94-09d7-4df9-85e6-d6930abc6c12" />
<Property Name="Description" TypeKey="b104788f-4e2f-4592-9387-8b3861bd8046" />
</Properties>
</Entity>
My end goal is to provide intellisense when editing a Entity Type so that I'll get all the Data Types as suggestions when entering the "TypeKey" property of the Property element. Preferably showing the Name of the data type in the dropdown list and when choosing it adding the guid as value for the TypeKey-property. I would also like to show the Data Types name when hovering the GUID with the mouse (or in some other way).
As you can imagen during the process with a project new data types can be added so the intellisense needs to be dynamic based on the files in the data types-folder.
I should also mention that these configuration files also can be edited from a UI in the application and I don't have control over how they are serialized, hence - there is no XML namespace in the files, they look like in the examples above.
We also have multiple different VS-solutions with different setups of Data Types and Entity Types. So we need individual intellisense in each project.
What I've tried
My first idea was to create a VS-extension that creates a dynamic XML Schema XSD-file based on the files in the data types folder. The VS would then pick up and use the XSD for XML-files in the Project, turns out that this only works with a namespace configured (remember, I can't add namespaces since I don't control the external app).
To get around this it worked to manually add the schema-file to the XML file while editing the file. (Like this: https://learn.microsoft.com/en-us/visualstudio/xml-tools/how-to-select-the-xml-schemas-to-use?view=vs-2019). The problem with this is that it needs to be done for each xml-file and the setting is not stored.
I then started to play with the VS extension possibilities to try to automatically configure this Schema to a XML-file that is opened. Turns out I had a really hard time to get the "configuration object" that is pushed to the Properties Browser when the XML file is opened. I managed to get a event-handler setup that was triggered when the XML files as getting "focus" but I was stucked trying getting the properties from the Properties Browser.
I also tried another approach with a custom "code completion"-extension but it made the UI feel very "cluttered" while editing.
After spending about 10 hours playing around with this I feel I don't really have a good path to a solution as my experience with VS-extensions is not that extensive.
I would love to get some feedback and ideas on how to approach this problem, since the XSD is different from each project if I go down the "dynamic" path we can't use the global VS settings since each project has different data types hence needs different allowed values for the TypeKey property.
One approach that I'm thinking about is to use a generic XSD (allowing all values for the TypeKey) in the Global Schema Cache for Visual Studio and create a "code completion"-feature for just the TypeKeys.
Any thoughts and pointers in the right direction would be very much appreciated.
Related
In Titanium, what is the differences between the following two lines of codes?
Ti.App.currentUser = "user1";
Ti.App.Properties.setString("currentUser", "user1");
Ti.App.Properties :
The App Properties module is used for storing application-related data in property/value pairs that persist beyond application sessions and device power cycles.
App Properties in the tiapp.xml file
App properties defined in the tiapp.xml file may be accessed using these APIs. An app property is defined inside the root-level <ti:app> element with the <property> element. Use the name attribute to define your property name and place the value inline with the <property> element. For example, to define an app property called foo with the value 42:
<?xml version="1.0" encoding="UTF-8"?>
<ti:app xmlns:ti="http://ti.appcelerator.org">
<property name="foo" type="string">42</property>
</ti:app>
Ref : http://docs.appcelerator.com/platform/latest/#!/api/Titanium.App.Properties
Ti.App.VariableName stores a variable not persistent and only for the App runtime.
The top-level App module is mainly used for accessing information about the application at runtime, and for sending or listening for system events.
The App module exposes a number of properties set in the tiapp.xml file.
Three of these properties, the application name, ID, and URL, must be specified when the application is created.
While most values may be changed by editing the tiapp.xml file after creating the project, the GUID is automatically generated and should not be changed.
More details Titanium.App
At the end if you want store and retrieve values in tiapp.xml file you should use Titanium.App.Properties
Abada does a great job explaining the difference, but let me emphasis that you should not add any custom properties to Titanium proxy objects like Ti.App. This is bad practice because it may lead to memory leaks and unpredictable behaviour. These objects are not 100% JS but bridge to Obj-C/JAVA/C+
Visual Studio project structure - https://www.box.com/s/np59x20f939n3z1g5dvc
I have multiple projects A, B, etc. that have load tests (which in turn call respective web tests) and a settings file separately for each one of them. I am using these settings files to store the info about web servers.
[Settings.xml]
<?xml version="1.0" encoding="utf-8" ?>
<AppSettings>
<WebServer>www.abc.com</WebServer>
<Proxy></Proxy>
</AppSettings>
I am adding this xml file as a data source in the web test as shown here https://www.box.com/s/53vy0ryvye53m76abuun
Project C has a load test that calls upon web tests from other projects (I am only referring to the projects A, B, etc. here). The setting file for project C looks like this.
<?xml version="1.0" encoding="utf-8" ?>
<AppSettings>
<WebServer>www.SomeOtherWebsite.com</WebServer>
<Proxy></Proxy>
</AppSettings>
I want this settings file to be used for running the Loadtest-C i.e. this settings file has to override the individual settings file from each project.
I want to run LoadTest-C sometimes and LoadTest-A or LoadTest-B sometimes. So, I don’t want to change the individual settings files everytime.
Is there a way I can achieve this?
I found using xml files to be the simpler way. But, please do suggest me if there is a better way.
I have searched online and the only thing I found relevant was this - common Settings.settings file for entire solution. I have a lot of projects similar to A, B, etc. and I don’t want to change the links in each and every project as suggested in the answer there.
[I have never tried coded web tests. So I am not sure if that approach works.]
[and i am relatively new to performance testing]
I have found a solution for this. Instead of using the Settings.xml file, I am adding the entries in that xml file as context parameters to the load test and eliminating the use of data source in individual web tests. So when I run the web test, the parameter it has for web server name is being supplied by the context parameter in the load test.
This might not be the best solution, but this seems to work for me.
I have a very basic setup, currently, and I'm fairly new to Sharepoint. I followed the walkthrough here to create a Field definition, content type, list definition from the content type, and a list instance from that list definition.
Currently, if I attempt to deploy my feature with everything in it, I get the following error:
Error occurred in deployment step 'Activate Features': Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
The feature doesn't show up in the administration panel, but the list instance is created (but has no fields because the custom content type isn't activated).
If I remove the listinstance from the feature, everything else activates just fine, and if I put the listinstance in a separate feature it still works, but this really all needs to be in one feature and I don't understand why it doesn't work that way. I added a guid to the list instance that was auto generated because I need to reference this list in the rest of the feature's code. This is the list instance's Elements.xml file:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ListInstance Title="SurveyModule - SurveyList"
Id="{C0ED4B73-B140-4057-989B-43344CEE921E}"
OnQuickLaunch="TRUE"
TemplateType="10000"
Url="Lists/SurveyModule-SurveyList"
Description="My List Instance">
</ListInstance>
</Elements>
If there are any other code snippets which would be relevant I can post them.
try it without the braces in the id attribute
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ListInstance Title="SurveyModule - SurveyList"
Id="C0ED4B73-B140-4057-989B-43344CEE921E"
OnQuickLaunch="TRUE"
TemplateType="10000"
Url="Lists/SurveyModule-SurveyList"
Description="My List Instance">
</ListInstance>
</Elements>
if it still doesn't work, generate a new GUID using: Visual Studio - Tools - Generate GUID (Registry)
I'm creating an InstallShield 2011 basic MSI installer project.
I'm trying to change the connection string in my app.config according to the user selections from the database login dialog made in the setup. How can I apply these connection string settings to the connection string entry in the app.config of my windows application I'm trying to install?
XML File Change is the right place to start from. Since changing the connection string is a common task my hope was that there is a best practice to do exactly this task.
-- edit --
There are two main difficulties:
How do I reference a file in InstallShield which will be created on build? The App.config gets copied to MyAppName.config. I don't want to hardwire the application name into the setup at this place again.
The connection string in the config file is used by Entity framework, thus contains more information than given by the database selection from InstallShield. I have to patch an attribute within an element of the config file, if I just want to change the Server and InitialCatalog properties of the connection string. It looks like XML File Change only supports replacing of an entire element or attribute.
As far as I remember, the XML File Changes is designed for this purpose. You can place the user's choice as a property value when defining your XPath and element/attribute values. For me, it was one of the areas of InstallShield which worked quite good and as described.
I am building a SharePoint Feature to deploy a simple WebPart and a custom list within the "Web" scope.
When the solution is deployed my list is immediately available in Site Actions -> Site Settings -> Custom Lists.
If you try and create an instance of the list I receive "File Not Found"
If you activate the feature a second copy of the list template is added to the Custom Lists heading.
Neither list can be created with the same "File Not Found" error
On deactivating the feature one list template disappears
On retracting the solution the last list template disappears
Files Involved:
schema.xml is 5000 lines long
feature.xml is as follows
<?xml version="1.0" encoding="utf-8" ?>
<Feature Id="78a8eaad-2160-434c-81c2-6c5f7ce94ade" Title="WeekWidget" Description="Displays A, B or H based upon a configurable SharePoint List." Version="1.0.0.0" Creator="Cardinal Newman Catholic School // Richard Slater" Scope="Web" ImageUrl="WeekWidget\WeekWidgetLogo.jpg" xmlns="http://schemas.microsoft.com/sharepoint/" DefaultResourceFile="core">
<ElementManifests>
<ElementManifest Location="ListTemplates\WeekCalendar.xml" />
<ElementFile Location="WeekCalendar\Schema.xml" />
</ElementManifests>
</Feature>
WeekCalendar.xml is as follows
<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ListTemplate Name="WeekCalendar" DisplayName="Week Calendar" Description="List of Weeks." BaseType="0" Type="100" OnQuickLaunch="TRUE" SecurityBits="11" Sequence="410" Image="/_layouts/images/itgen.gif" />
</Elements>
I think the "File Not Found" error is symptomatic of another problem, however the addition of the list template shouldn't happen on solution deployment. What am I doing wrong?
are you wiring up all of the feature files yourself or using a tool? typically, the 404 means one of the 'magic strings' in your configuration files is off. Also, the directory structure specified here looks suspicious:
<ElementManifests>
<ElementManifest Location="ListTemplates\WeekCalendar.xml" />
<ElementFile Location="WeekCalendar\Schema.xml" />
</ElementManifests>
You should try deploying all of your feature support files to the same directory. Have you located the error in the ULS log (<12 hive>/LOGS)? That may provide some clues too.
I think the problem could be related to the separate directory structure--I usually deploy all list files to the same folder (schema.xml and weekcalendar.xml, in your case; keep feature.xml out of the list directory).
Turn on verbose logging and check the 12-hive logs to see what file is not found.
Check schema.xml and ensure the name attribute on the list element matches the name of the folder housing your feature. Also watch out for the Url attribute on this element... VSeWSS will set the URL to the name of the list being reverse engineered so I change it to "pages\viewpage.axp".
On the default view element within schema.xml, try adding SetupPath="pages\viewpage.aspx". Ensure there's a WebPartZoneId="Main" attribute on there as well.