Marko Apfel

EAI, BizTalk, SQL Server, C#

  Home  |   Contact  |   Syndication    |   Login
  64 Posts | 2 Stories | 23 Comments | 4 Trackbacks

News



Article Categories

Archives

Post Categories

BizTalk

C#

Enterprise Library

SAP

SQL Server

Technologie

Thursday, November 26, 2009 #

After installing VS2005 TE on my machine (which previously runs Visual Studio 2008 TE) all mixed projects (VS2005/VS2008 compatibility with TargetFramework=2.0 and ToolsVersion=2.0 options) thrown an error during compilation:


C:\Program Files\MSBuild\Microsoft\VisualStudio\v8.0\CodeAnalysis\Microsoft.CodeAnalysis.targets(46,4):
error : In order to perform Code Analysis on managed binaries, MSBuild needs to launch FxCop.
MSBuild is unable to locate the FxCop binaries.
Make sure Visual Studio Team Edition for Software Developers or Visual Studio Team Suite is installed
and run MSBuild from within the "Visual Studio Command Prompt"
or specify the path to FxCop by setting the FXCOPDIR environment variable.

Specifying the FXCOPDIR-variable brings up the next obscure errors.

Replacing the VS2005 CodeAnalysis targets with the VS2008 targets lets run everything fine.

So replace [dont forget to make a backup ;-)]

C:\Program Files\MSBuild\Microsoft\VisualStudio\v8.0\CodeAnalysis

with

C:\Program Files\MSBuild\Microsoft\VisualStudio\v9.0\CodeAnalysis

But now you get an error in Visual Studio 2005:


MSBUILD : error : Invalid settings passed to CodeAnalysis task. See output window for details.
Code Analysis Complete -- 1 error(s), 0 warning(s)

Setting the build output information to diagnostic you get an good hint what the problem is.

So we edit as the last step the VS2005 target:

the line

<UsingTask TaskName="Microsoft.Build.Tasks.CodeAnalysis" AssemblyFile=".\FxCopTask.dll"/>

we modify to:

<UsingTask TaskName="Microsoft.Build.Tasks.CodeAnalysis" AssemblyFile="..\..\v9.0\CodeAnalysis\FxCopTask.dll"/>

 

and the following lines

<CodeAnalysisPath Condition="'$(CodeAnalysisPath)'=='' and '$(FxCopDir)'!='' and '$(TeamBuildConstants)'==''">$(FxCopDir)</CodeAnalysisPath>
<CodeAnalysisPath Condition="'$(CodeAnalysisPath)'=='' and '$(VSINSTALLDIR)'!=''">$(VSINSTALLDIR)\Team Tools\Static Analysis Tools\FxCop</CodeAnalysisPath>

are replaced with

<CodeAnalysisPath>C:\Program Files\Microsoft Visual Studio 9.0\Team Tools\Static Analysis Tools\FxCop</CodeAnalysisPath>

 

not beautiful – but working!


Open a “visual studio command prompt” and try:

tfsbuild stop https://*****:8143 RXXXXX_Sourcecode Gen_2.6_branch_test_20080827.1

Wednesday, November 25, 2009 #

By using the argument line array of Main(string[] args) it is important to know such effect.

If you specify a quoted folder (e.g. "C:\Projects\PDE\PRJ_EsriDE_Common\trunk\code\Commons\bin\Debug\") the ending backslash makes troubles.

My whole argument line (linebreaked for better viewing):

-inDir:"C:\Projects\PDE\PRJ_EsriDE_Common\trunk\code\Commons\bin\Debug\"
-recursive:false
-filter:*
-separation:AssemblySeparated
-outDir:"C:\Projects\PDE\PRJ_EsriDE_Common\trunk\code\Commons\bin\Debug\"
-outFile:AllInOneReg
-outFormat:RegistryFile

is wrongly splitted to:

The following variant without a ending backslash:

-inDir:"C:\Projects\PDE\PRJ_EsriDE_Common\trunk\code\Commons\bin\Debug"
-recursive:false
-filter:*
-separation:AssemblySeparated
-outDir:"C:\Projects\PDE\PRJ_EsriDE_Common\trunk\code\Commons\bin\Debug"
-outFile:AllInOneReg
-outFormat:RegistryFile

is no problem:

and also the forward slashes:

-inDir:"C:/Projects/PDE/PRJ_EsriDE_Common/trunk/code/Commons/bin/Debug/"
-recursive:false
-filter:*
-separation:AssemblySeparated
-outDir:"C:/Projects/PDE/PRJ_EsriDE_Common/trunk/code/Commons/bin/Debug/"
-outFile:AllInOneReg
-outFormat:RegistryFile

works in both variants (with and without an ending one):


Tuesday, November 17, 2009 #

During a refactoring we searched for full type names in our IoC-config files. The filter was setted to *.xml and Visual Studio does not found all occurrences of the search string in these xml-files.

Setting the filter to *xml without the dot solves this problem – however.


Thursday, November 12, 2009 #

if you see the following warnings in your code:

You have two choices:

  • deactivate the rule
    but this disables this rule for all documentations – also the wanted
  • tune the detail settings
    In the settings editor you see additional options if you select the “Documentation Rules” root node

Normally i want to ignore the warnings for missing private and internal documentations and also for documentation of fields.


Installing StyleCop for ReSharper under an administrative account does not activate this ReSharper plugin under my developer account.

A system analysis show, that this plugin is installed under

%userprofile%\Local Settings\Application Data\JetBrains\ReSharper\v4.5\vs9.0\Plugins\Microsoft StyleCop for ReSharper

This gives the hint, that the msi must be started for each individual user separately – maybe the is the possibility to move the stuff to all users or that there is also an administrative installation possible.


If AgentSmith throws a warning that some term is not spelled correctly for this term the spell checking could be suppressed with:

//agentsmith spellcheck disable
...
//agentsmith spellcheck enable


Wednesday, November 11, 2009 #

see also Working with Microsoft FxCop

As described in the previous post a custom dictionary could be referenced in a FxCop-call of a target by using the option:

/dictionary:&quot;$(ProjectDir)..\FxCop.CustomDictionary.xml&quot;

But how is it possible to publish this custom dictionary for the Visual Studio integrated code analysis?

This analysis runs an other FxCop.exe than my special FxCop-target. So the custom dictionary which is specified in the FxCop-call of my target is not used.

The solution is very simple. Because every project gets the FxCop-target the information about the custom dictionary could be inserted there.

This is done with the section:

<ItemGroup>
<CodeAnalysisDictionary Include="&quot;$(ProjectDir)..\FxCop.CustomDictionary.xml&quot;" />
</ItemGroup>

Visual Studio code analysis uses this information. So with one line all projects are satisfied.


Run FxCop as a post build event

Since FxCop 1.36 it is possible to include FxCop in a post-build event.

So FxCop runs after compiling in Visual Studio and allows you directly jumping to the warned line.

 

Description of the command line

In the sample above the command line is

IF $(ConfigurationName) == Debug $(ProjectDir)..\..\..\..\tools\FxCop\FxCopCmd.exe
/console  
/file:"$(TargetPath)" 
/directory:"$(ProjectDir)..\..\..\..\lib\Primary Interop Assemblies" 
/directory:"$(ProjectDir)..\..\..\..\lib\ArcGIS\9.2.0.1324" 
/dictionary:"$(ProjectDir)..\..\..\CustomDictionary.xml"

 

Parameter Description
/console Outputs messages to console, including file and line number information.
/file

Assembly file to analyze.

$(TargetPath) is a makro-variable of Visual Studio which points to the compilation.

Wrap it in quotations to avoid problems with spaces in path names.

/directory

Location to search for assembly dependencies. This parametes could occurs multiple times.

$(ProjectDir) is a makro-variable of Visual Studio which points to the *.csproj-file of the project.

/dictionary

Custom dictionary to allows own abbreviations and own words for syntax checking.

 

Integration as a build target

Integration as an own target

Instead running FxCop as a post build event the using of build targets is a good and since using of Hudson the recommended way.

In the csproj file therefore a new target must included. You could name it De.Esri.FxCop.targets for instance.

Place the call of this target beneath the normal build target.

<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\De.Esri.FxCop.targets" />

And now we need this target. Important is the FxCopCmd-call. Therefore we use the Exec tag.

The whole call must made in one line. Only for documentation purposes every option has a own line.

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BuildDependsOn>$(BuildDependsOn);FxCop</BuildDependsOn>
<RebuildDependsOn>$(RebuildDependsOn);FxCop</RebuildDependsOn>
</PropertyGroup>

<ItemGroup>
<CodeAnalysisDictionary Include="&quot;$(ProjectDir)..\FxCop.CustomDictionary.xml&quot;" />
</ItemGroup>

<Target Name="FxCop">
<Exec Command="..\..\tools\FxCop\FxCopCmd.exe
/file:&quot;$(TargetPath)&quot;
/dictionary:&quot;$(ProjectDir)..\FxCop.CustomDictionary.xml&quot;
/out:&quot;$(OutDir)..\$(ProjectName).FxCopReport.xml&quot;
/console /forceoutput"

WorkingDirectory="..\..\tools\FxCop\" ></Exec>
<Message Text="FxCop finished." />
</Target>
</Project>

Because the filesystem ressource parameters could contain spaces (e.g. )Program Files) these parameters must be quoted. Thats why we need the cryptical &quot; there.

Integration as a MSBuild-Community target

John Rayner's Blog

Complex build script run FxCop:

Integrating FxCop into CruiseControl.NET


Monday, November 09, 2009 #

Today a colleague ask me to help.

On his system all ReSharper menus are grayed out. Also the Visual Studio Add-In Manager does not show this add-in.

He tried:

  • a new installation: without success,
  • running with administrative privilegeg: without success,
  • looking in event- and application-logs: no entries.

After searching a little bit with old buddy google we found this message: Wild World of Visual Studio -- Mysterious Component

We downloaded and installed the latest Microsoft Core XML Services (MSXML) 6.0 Service Pack 1 and ReSharper works fine. :-)

The colleague remembered that he uninstalled SQL Server 2005 – and for this MSXML6 is a installation feature – so a full deinstallation removes MSXML6 also. :-(


Thursday, February 23, 2006 #

Wenn ein Remote-Zugriff auf einen SQL Server 2005 mit der Fehlermeldung

"A connection was successfully established with the server, but then an error occurred during the pre-login handshake.
When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections."

scheitert, dann hilft folgendes

  1. Öffnen der SQL Server Surface Area Configuration
  2. Anwählen von "Surface Area Configuration for Services and Connections"
    Unter "MSSQLSERVER > Database Engine > Remote" den Zugriff auf "Local and remote connections" mit Unterpunkt "Using both TCP/IP and named pipes" setzen
  3. SQL Server neu starten

Beim Installieren des Enterprise Single Sign-On Dienstes kommt folgende Fehlermeldung:

The database server you specified cannot be reached.
Make sure you have specified the correct server name and that the server is currently running.
Login failed for user ***

Die Domain-Gruppe der "SSO Administratoren" muss in die Gruppe der lokalen Adminstratoren auf der SQL Server Maschine. Der Installations-User bekommt durch die Mitgliedschaft in "SSO Administratoren" dann Admin-Rechte im SQL-Server.


Beim Starten einer Web-Anwendung kommt der Fehler:

Unable to start debugging on the web server.
Debugging failed because integrated Windows authentication is not enabled.
Please see Help for assistance.

Es wurde vergessen eine Authentifizierung für die Web-Applikation zu setzen.

  1. Internet Information Services (IIS) Manager starten
  2. Rechtsklick auf Default Web Site
  3. Tab Directory Security
  4. Edit-Button im Abschnitt "Authentication and access control" anklicken
  5. Im Abschnitt "Authenticated access" ein Häkchen bei "Integrated Windows authentication" setzen

Thursday, March 16, 2006 #

Schon eim Aufrufen der Default-Webseite unter http://localhost kommt die Fehlermeldung "Service unavailable" und im Eventlog tauchen Warnings und Errors auf.

Warnings

A process serving application pool 'DefaultAppPool' terminated unexpectedly.
The process id was '5920'.
The process exit code was '0xffffffff'.

Errors

Application pool 'DefaultAppPool' is being automatically disabled due to a series
of failures in the process(es) serving that application pool.

bzw:

The application-specific permission settings do not grant Local Activation permission for 
the COM Server application with CLSID {A9E69610-B80D-11D0-B9B9-00A0C922E750}
to the user NT AUTHORITYNETWORK SERVICE SID (S-1-5-20).
This security permission can be modified using the Component Services administrative tool.

mögliche Ursache

Grund können verloren gegangene Berechtigungen am DCOM-Object des IIS Admin Services sein.

Zum neuen Setzen die Component Services starten und die Properties von My Computer > DCOM Config > IIS Admin Service öffnen.

Auf dem Tab Security wechseln und die Launch and Activation Permissions editieren.

Nun die Gruppe der Authenticated Users aufnehmen und Local Activiation sowie Remote Activation setzen.


Setzen der SID

Die SID eines Systems zu ändern ist kein Problem dank SysPrep und Co.

Ermitteln

Wie ermittelt man aber die aktuell gesetzte SID?

Das geht ganz fix mit PsGetSid aus den PsTools von SysInternals.

Einfach Auspacken und ohne Optionen starten liefert die SID für das aktuelle System.