I am using Visual Studio 2012 Express and therefore don't have access to the integration for the regular version of VS. I have used the MSBuild to integrate StyleCop and the rules show up as Warnings. I want to be able to disable rules. The Disabling StyleCop rules post shows that this is possible but I can't make sense of the answer which suggests to edit the Settings.StyleCop file. However, I don't understand what is required to be added to this file to disable a rule.
If I wanted to disable rule SA1649 for instance how would I update the following file?
<StyleCopSettings Version="4.3">
<GlobalSettings>
<CollectionProperty Name="DeprecatedWords">
<Value>preprocessor,pre-processor</Value>
<Value>shortlived,short-lived</Value>
</CollectionProperty>
</GlobalSettings>
<Parsers>
<Parser ParserId="StyleCop.CSharp.CsParser">
<ParserSettings>
<CollectionProperty Name="GeneratedFileFilters">
<Value>\.g\.cs$</Value>
<Value>\.generated\.cs$</Value>
<Value>\.g\.i\.cs$</Value>
</CollectionProperty>
</ParserSettings>
</Parser>
</Parsers>
<Analyzers>
<Analyzer AnalyzerId="StyleCop.CSharp.NamingRules">
<AnalyzerSettings>
<CollectionProperty Name="Hungarian">
<Value>as</Value>
<Value>do</Value>
<Value>id</Value>
<Value>if</Value>
<Value>in</Value>
<Value>is</Value>
<Value>my</Value>
<Value>no</Value>
<Value>on</Value>
<Value>to</Value>
<Value>ui</Value>
</CollectionProperty>
</AnalyzerSettings>
</Analyzer>
</Analyzers>
</StyleCopSettings>
Note: I am using version 4.7 even though the default settings file shows 4.3
I found the following documentation to edit a stylecop rule in the XML
The XML code snippet is below.
<StyleCopSettings Version="4.3">
<Analyzers>
<Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.LayoutRules">
<Rules>
<Rule Name="StatementMustNotBeOnSingleLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementMustNotBeOnSingleLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
</Analyzers>
</StyleCopSettings>
In addition, I also found out that you can drag the Settings.Sytlecop file onto the StyleCopSettingsEditor.exe which presents a GUI for enabling and disabling the rules.
Paste the below code in notepad and save as settings.StyleCop and place it in solution folder and build
<StyleCopSettings Version="105">
<GlobalSettings>
<BooleanProperty Name="RulesEnabledByDefault">False</BooleanProperty>
</GlobalSettings>
</StyleCopSettings>
Related
I have two build projects. lets call them project A and project A.pack. When I force build project A it asks me for Boolean parameter if I want to build project A.pack.
But I can't make in publishers block of project A a correct way to force build the project A.pack. I use conditional task but it doesn't work. In log file ccnet writes only that it fails on conditional task. What a usual way to do this in ccnet?
Update:
Sorry for my English. It's not my first language.
What I wanted to do is this:
In project A I added Boolean parameter:
<booleanParameter>
<name>ExampleParam</name>
<true name="Yes">1</true>
<false name="No">0</false>
<display>Example Param</display>
<default>No</default>
<required>false</required>
</booleanParameter>
And added conditional forcebuild in publishers like this:
<publishers>
<!-- some other tasks .. -->
<conditional>
<conditions>
<compareCondition>
<value1>${ExampleParam}</value1>
<value2>1</value2>
<evaluation>equal</evaluation>
</compareCondition>
</conditions>
<tasks>
<forcebuild>
<project>A.pack</project>
<serverUri>tcp://localhost:21235/CruiseManager.rem</serverUri>
</forcebuild>
</tasks>
</conditional>
</publishers>
When I press "force" it asks me for "Example Param", I check "Yes" and when it finishes building dashboard says that build was succesful but ForceBuildPublisher task failed.
There is no information in server log about why force build task failed.
It's CruiseControl.NET-1.6.7
Update 20150808:
I convinced my colleagues to update CCnet. In version 1.8.5 it's possible to do a conditional build like I wrote.
If the boolean parameter is true then write to a file that A.pack watches. A.pack builds if the file gets dirty. See Filesystem Source Control Block for use by A.pack in listening to the file made dirty by A.
i am trying to get the html log file for the coded ui tests.
i tried the steps mentioned in the following link
https://msdn.microsoft.com/en-us/library/jj159363(v=vs.110).aspx
By default it generated .png file(image file) which captures only the screenshot of the active window where the error occurred.
So i tried using the other values for "EqtTraceLevel" in the configuration file, but there is no difference, it still generates image file.
Does it work for Windows application? if it does what are the additional settings required?
To enable HTML logging in your tests you should add Playback.PlaybackSettings.LoggerOverrideState = HtmlLoggerState.AllActionSnapshot; to your test.
This will show all steps taken in your test and a corresponding screenshot of your application under test. It will also show you a highlight rectangle to show the found control.
Alternatively change QTAgent32.exe.config or QTAgent32_40.exe.config in C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE (or where you have VS installed) to contain the following settings:
<appSettings>
<!--- Your settings -->
<add key="EnableHtmlLogger" value="true"/>
</appSettings>
And to increase the detail of your logging:
<switches>
<add name="EqtTraceLevel"value="4"/>
</switches>
Where 0 is off, 1 for errors, 2 for warnings, 3 for info and 4 for verbose.
I'm trying to distribute some SQL_SSDT Visual Studio code snippets using .vsi and .vscontent files, but I'm getting an error while installing:
The .vscontent file either contains invalid attributes or specifies a code snippet for a programming language that is not installed.
The .vscontent file is based on the documentation provided by Microsoft How to: Distribute Code Snippets
The sample on this site is the following:
<VSContent xmlns="http://schemas.microsoft.com/developer/vscontent/2005">
<Content>
<FileName> </FileName>
<DisplayName> </DisplayName>
<Description> </Description>
<FileContentType> </FileContentType>
<ContentVersion>2.0</ContentVersion>
<Attributes>
<Attribute name="lang" value=""/>
</Attributes>
</Content>
</VSContent>
My file looks like this:
<VSContent xmlns="http://schemas.microsoft.com/developer/vscontent/2005">
<Content>
<FileName>SSDTTest.snippet</FileName>
<DisplayName>SSDTTest</DisplayName>
<Description>SSDTTest</Description>
<FileContentType>Code Snippet</FileContentType>
<ContentVersion>1.0</ContentVersion>
<Attributes>
<Attribute name="lang" value="SQL_SSDT"/>
</Attributes>
</Content>
</VSContent>
I'm using the value SQL_SSDT since this is the required value in the .snippet files (<Code Language="SQL_SSDT">).
The installation starts as expected (double clicking on the .vsi file), the VS Content Installer pops up, lists the included content. The error occurs after hitting Finish. (Installation starts, but the above error pops up after a few seconds.)
The snippet is working fine if I copy it to the default snippet folder for SSDT (Documents\Visual Studio 2012\Code Snippets\SQL_SSDT\My Code Snippets) or if I'm adding it via snippet manager in SSDT, but the .vsi installation fails using the above file.
Am I missing something?
Installed VS products on this box:
SSDT
SSDT-BI
VS Express for Desktop (2012)
Update
I found the XML schema reference for the .vscontent files (VS2012), and it seems that the SQL_SSDT is not a valid value for the Lang attribute. It suggests that there are only four values available for the lang attribute. (csharp, jsharp, vb, xml).
Now the question is: Does SSDT add any extensions to this XML schema?
It seems that VS Content Installer has no support for deploying SSDT code snippets. There is a posted idea on visualstudio.uservoice.com which requests this feature, but it is still open.
I did not found any other resources related to this issue.
There is a possible workaround, which needs testing: You can create a PS/BAT which copies the snippet files into the VS's snippet folder for SSDT.
I am new to Dynamics CRM 2011 Online. I am try to generate the data context class using CrmSvcUtil.exe
This is my command:
CrmSvcUtil.exe /out:E:\OrgXrm.cs
/url:https://mdtestuser.api.crm5.dynamics.com/XRMServices/2011/Organization.svc
/username:MDTest#MDTestUser.onmicrosoft.com /password:Password
But its giving an error:
Exiting program with exception: An error occurred when verifying
security for th e message. Enable tracing and view the trace files for
more information. CrmSvcUtil.exe Error: 0 : Exiting program with exit
code 2 due to exception : Sy stem.ServiceModel.FaultException: An
error occurred when verifying security for the message.
I was researching another issue when I ran across a post in the Microsoft forums that may help. I remembered this question so I thought I would post another answer as this one had a positive resolution.
Quote:
I have dealt with this one before. Verify the Time and Date settings (including timezones) are set correctly on both the server and your client machine. It seems that if the two machines are out of sync by more than a minute or two it will cause this problem.
On my client machine I had to restart Visual Studio also for some reason after I set the server clock to get it to connect up properly.
http://social.microsoft.com/Forums/en-US/0ad9a5ee-dcce-4146-a1e6-20eafdccff46/crmsvcutil-error-an-error-occurred-when-verifying-security-for-the-message?forum=crmdevelopment
To fully understand your error, you should use config file with enable tracing, here is an example of config file:
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="servicecontextname" value="XrmServiceContext"/>
<add key="codecustomization" value="Microsoft.Xrm.Client.CodeGeneration.CodeCustomization, Microsoft.Xrm.Client.CodeGeneration"/>
<add key="username" value="domain\user"/>
<add key="password" value="password"/>
<add key="out" value="XrmEntitiesReference.cs" />
</appSettings>
<system.diagnostics>
<trace autoflush="false" indentsize="4">
<listeners>
<add name="configConsoleListener" type="System.Diagnostics.ConsoleTraceListener">
<filter type="System.Diagnostics.EventTypeFilter" initializeData="Error" />
</add>
</listeners>
</trace>
</system.diagnostics>
</configuration>
check out example from here:
http://www.resultondemand.nl/support/sdk/06abab26-40fc-4b85-9a2a-5e68903ea138.htm
JIC somebody get the same error.
I made the connection and I were able to generate the context from CRM online. The unique difference is in the URL, I have the next:
https://architecture2.api.crm.dynamics.com/XRMServices/2011/Organization.svc
You see this say crm not crm5 but that depends on your organization, to get the rigth one:
Open your organization then Settings->Customizations->Developer Resources->Organization data service
My command line to execute CrmSvcUtil.exe is:
CrmSvcUtil.exe
/url:"https://architecture2.api.crm.dynamics.com/XRMServices/2011/Organization.svc"
/out:"E:\Context.cs"
/username:MyUser#architecture2.onmicrosoft.com
/password:Password
Something else the account should have the required permissions, my account has System Administrator role.
I realize this is a long-shot, but has your password changed recently?
With a command string like this, a lot of people use .bat files to automate the process.
I dislike using passwords in .bat files because:
They are not secure (obvious, I know)
Maintenance. Every time you update your password, you would have to remember to update every script. Or painfully troubleshoot every failure and finally remember that the password was embedded.
To mitigate this I use SET with a /P parameter to prompt for a password during .bat file execution.
Not perfect, but a lot better than hard coding a password.
Here is an example using the command string you supplied:
rem ----- begin script -----
SET /P pwd=Password:
CrmSvcUtil.exe /out:E:\OrgXrm.cs /url:https://mdtestuser.api.crm5.dynamics.com/XRMServices/2011/Organization.svc
/username:MDTest#MDTestUser.onmicrosoft.com /password:%pwd%
CLS
SET pwd=.
rem ----- end script -----
In this example the SET /P tells the command processor to set an environment variable and prompt for the input.
“pwd” is the environment variable being set.
“%pwd%” is the actual use of the environment variable.
“Password:” is the prompt string that will be displayed when the .bat file is run.
“CLS” clears the screen.
“pwd=.” sets the environment variable to “.” so the password is not left in the environment.
You can ignore the lines beginning with “rem” as they are simply remarks.
The “not perfect” part of the solution is that your password is visible as you type. However by clearing the screen immediately following the prompt it is cleared from the screen right away. There are other ways to prevent the password from being visible as you type, however I think they are vastly over complicated or require downloading some additional bits. The idea of using a .bat file is that it is quick and easily updatable ergo low maintenance.
The SET /P works well in my case as no one is looking over my shoulder whenever I need to refresh my file, and there is virtually no maintenance once the .bat file is written.
I have two Subsonic-generated Data Access Layers for 2 different databases that I use in one project and so I have the following in my web.config:
<SubSonicService>
<providers>
<add name="BLLDB" type="SubSonic.SqlDataProvider, SubSonic" connectionStringName="BLLDB" generatedNamespace="BLLDB" useSPs="true" />
<add name="BLLDB2" type="SubSonic.SqlDataProvider, SubSonic" connectionStringName="BLLDB2" generatedNamespace="BLLDB2" useSPs="true" />
</providers>
</SubSonicService>
yet, anytime I call the code for either DAL it always ends up using the second data Provider listed ("BLLDB2"), and so gives an error like "Invalid object name 'dbo.Users'" when it should be reading from "BLLDB" (despite me explicitly specifying "BLLDB" in the Select())
e.g. check the following code for the "BLLDB" DAL:
Dim mySelect As New
SubSonic.Select(Databases.BLLDB)
mySelect.From(Of User)()
"mySelect.ProviderName" returns a string value: "BLLDB2"
whereas "Databases.BLLDB" returns a string value: "BLLDB"
what gives??
One of your provider is failing. Subsonic is not good about telling you why and where its failing.
I usually debug in couple of ways.
Use only one provider at a time and comment the other one. Check if you are able to see the namespace. If both of them load fine, then you atleast know its not the database.
Check if any of you tables start with -, _, or numbers. This can cause it fail as well.
Let me know how it goes.
You can specify which provider is default by using:
< SubSonicService defaultProvider="BLLDB" >
I am new to Subsonic (using version 2.2 with C#). I spent a lot of time trying to get the same configuration as Stimpy to work. I think I figured it out - my solution below. If this is correct, it would be great to add this information to the Select Queries documentation. so others can resolve this multiple data provider issue earlier.
Here's the web.config
<SubSonicService enableTrace="false" templateDirectory="">
<providers>
<clear/>
<add name="DB1" type="SubSonic.SqlDataProvider, SubSonic" connectionStringName="DB1" excludeProcedureList="*" generatedNamespace="DB1" includeTableList="TableA" tableBaseClass="RepositoryRecord"/>
<add name="DB2" type="SubSonic.SqlDataProvider, SubSonic" connectionStringName="DB2" excludeProcedureList="*" generatedNamespace="DB2" includeTableList="TableB,TableC" tableBaseClass="RepositoryRecord"/>
</providers>
Here's the statement that doesn't work (taken from the Select Queries documentation examples). SQL Server can't find "TableA" because it's looking for it in DB2 instead of DB1:
DB1.TableA doesntWork = new Select().From<DB1.TableA>().
Where("idCol").IsEqualTo(1).ExecuteSingle<DB1.TableA>();
(My assumption had been that the dataProvider for each table would have been generated as a property of the table class).
Here's the modification to make this work:
Select mySelect = DB1.DB.Select();
DB1.TableA works = mySelect.From<DB1.TableA>().
Where("idCol").IsEqualTo(1).ExecuteSingle<DB1.TableA>();
OR, this also works:
DB1.TableA worksAlso = new Select(DataService.GetInstance(Databases.DB1)).From<DB1.TableA>().
Where("idCol").IsEqualTo(1).ExecuteSingle<DB1.TableA>();
It seems that if you have a single dataProvider OR you specify in the SubSonicService config. that the default dataProvider is the one you're trying to use, everything works fine:
<SubSonicService enableTrace="false" defaultProvider="DB1" templateDirectory="">
But, if you leave out the "defaultProvider", it defaults to the last one in the providers list (in this case, DB2)
Another important piece of information for the multiple DAL case - if you generate the code into different folders for each provider, be sure to “include” in your project only ONE of the "AllStructs.cs" files that automatically gets generated into each folder (otherwise, compile errors).
FYI: kudos to the developers of this open source alternative to Codesmith. So far (other than this issue), it's been easy to get started and make it work (especially with SubStage). Also, I think it will end up being a lighter weight, cost-effective solution for my clients. Thank you!
I am using subsonic 2.2 substage. You need to change the namespaces for multiple providers respectfully.
One important thing. It will generate multiple "AllStructs.vb" files. It will be repeated by code automatically. But you need to add single allstructs.vb another just delete and it will work 1000%.
here would be the configuration settings at web config file.
<connectionStrings>
<add name="aspnetdb" connectionString="Data Source=(local); Database=aspnetdb; Integrated Security=true;"/>
<add name="office" connectionString="Data Source=(local); Database=office; Integrated Security=true;"/>
</connectionStrings>
<SubSonicService defaultProvider="aspnetdb" enableTrace="false" templateDirectory="">
<providers>
<clear/>
<add name="aspnetdb" type="SubSonic.SqlDataProvider, SubSonic" connectionStringName="aspnetdb"/>
<add name="office" type="SubSonic.SqlDataProvider, SubSonic" connectionStringName="office"/>
</providers>
</SubSonicService>
Hi all and thanks for the replies... Rob if I specify the default provider of "BLLDB" this ends up doing the same thing, but for BLLDB instead of BLLDB2
i.e. it only reads from BLLDB and not BLLDB2
CodeToGlory, I'm using the latest dlls and usually have no issues running SubSonic until I came across this prob.
Would it be possible for you to post up the web.config entries you use for subsonic where you have both providers working please?
Thanks a million!
P.S. It's also rather odd that when I specify which data provider to use directly in my Select() function:
e.g.
Dim mySelect As New SubSonic.Select(Databases.BLLDB)
mySelect.From(Of User)()
and then I do:
"mySelect.ProviderName", this returns a string value: "BLLDB2" (not correct)
whereas when I output the value for "Databases.BLLDB" this returns a string value: "BLLDB" (correct)
This could actually be the key to the problem...
Just answering my own question here .. it seems to indeed be NOT possible to use multiple providers when working through VB.NET.
This possibly only works in C# (as CodeToGlory mentioned), as I've tested several different scenarios from scratch and cannot get 2 Subsonic-generated DALs to work side-by-side
Will have to hack my own one together for one of them so.. Cheers for the advice though!