How to use MSBuild validate property? - msbuild

In MSBuild there is a property named validate, and he accepts a scheme as a parameter.
What is this schema?
How to write it?

How to use MSBuild validate property?
This property validate is used to specify a schema file .xsd to validate the project file.
How to use it:
Just like the document said:
If you don't specify schema, the project is validated against the
default schema.
If you specify schema, the project is validated against the schema
that you specify.
The following setting is an example:
-validate:MyExtendedBuildSchema.xsd
What is this schema?
XML Schema is commonly known as XML Schema Definition (XSD). It is
used to describe and validate the structure and the content of XML
data. XML schema defines the elements, attributes and data types.
Schema element supports Namespaces. It is similar to a database schema
that describes the data in a database.
Check the document XML - Schemas and XML Schema Tutorial for some more details.
Note: The default Schemas file for MSBuild: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Xml\Schemas\1033\Microsoft.Build.xsd.
Hope this helps.

Related

Search for a variable value in SSIS packages deployed in SSISDB integration Catalog

I have several packages/projects deployed in the SSISDB catalog. I want to find which packages have a specific expression attached to a variable value. Is there a TSQL way of doing this? I know the package data is encrypted in [internal].[packages]. But with the proper credentials, is it possible to decrypt it? Or what are the other options I have? Can I use some C#/Powershell script to search?
There is no tables that stores this kind of information. You should search for it by reading the package XML. Using SSISDB, it is not possible to read the package XML using T-SQL since SSISDB encrypts the whole project as binary.
To read the package's XML, you should extract the project binary using the SSISDB.cataloag.get_project stored procedure. Change the extract file extension to .zip and extract its content. Then, loop over packages to check if the variable is used in each package. This can be done using C# or PowerShell:
Extracting dtsx from Integration Service Catalog from C#
Get Package XML from SSIS Catalog with PowerShell
In case you are storing the database within SQL Server (Msdb) you can read the package XML data from the msdb.dbo.sysssispackages table.

I can't see my model classes

I have an application in MVC4 with Razor and Entity Framework database first.I have a SQL database . Base on this I generated the diagram (edmx) with new Item "ADO.NET Entity Data Model".I choose the database connection,my tables and program has generated a diagram with tables and relationships but I can find the class that must be generated after each choosen table (in solution explorer .For a table student from database i must have the mapping with a class student in my solution ).I want to add some validations .Can somebody tell what I done wrong ?
The EDMX diagram has a "code-behind" file. Click the > beside the .edmx file and you should see a file named the same as the .edmx but ending in .Designer.cs; the classes are defined in the "Entities" region in that file.
Having said that, you should never edit the contents of that file. The code in there is generated from your diagram, so any changes are lost when you alter the data model elsewhere. If you want to add validation attributes to your models, you'll need to create partial declarations somewhere else, and attach metadata classes to them. The accepted answer to this SO question shows what you'll need to do.
You must include the namespace of the EDMX file , you can see that in the properties of the file.
Let's say you create EDMX file in folder Models. in Solution Explorer -> Models -> Model1.edmx -> Model1.tt -> student.cs (this your student table class)

NHibernate configuration: Configure(pathToXml) vs AddXmlFile(pathToXml)?

What's the difference between
Configuration.Configure(string)//Configure NHibernate using the file specified.
and
Configuration.AddXmlFile(string)//Read mappings from a particular XML file.
?
It looks like the latter's functionality is a subset of the former's, but does anyone care to elaborate?
The first one is to configure dialect, driver and other configurations properties.
The second is used if you want to append an additional XML mapping (HBM) file to an existing configuration object.
For example, create a Configuration using FluentNHibernate then append a classic XML mapping (when migrating legacy NH application to FNH, for example).

HSQLDB creating database with properties in server.properties file

I want to create a database on server startup with certain properties. I have the following in my server.properties file:
server.database.0=file:db;check_props=true;sql.enforce_names=true;sql.pad_spaces=false;hsqldb.default_table_type=cached;hsqldb.tx=locks;hsqldb.tx_level=serializable;hsqldb.write_delay=false
server.dbname.0=ssi
I don't see these reflected in the resulting db.properties file. How should I do this?
These properties are for HSQLDB 2.2.9. The properties file for version 2.x does not contain such properties. The .script file contains the equivalent SQL setting statements.
Most URL properties, including those you have used, do not apply to an existing database.
There is also an issue check_props=true, which wrongly flags the sql.pad_space property.

MSBuild and BizTalk

Is it possible to specify (or override) the Deploy ApplicationName, database server, and database name for BizTalk projects? If so, how?
Unfortunately this data is stored in the btproj.user file instead of the .btproj file, and my client doesn't want to check the btproj.user files into the source control system.
(FYI - we are using BizTalk Build Generator from CodePlex.)
I've just reviewed the source on CodePlex. When I understood everything correctly they are generating
%AppName%.Custom.targets
%AppName%.Custom.properties
files. Within the properties file some properties are listed for BTS Database Connectivity
<BizTalkDatabaseServerName>.</BizTalkDatabaseServerName>
<BizTalkManagementDatabaseName>BizTalkMgmtDB</BizTalkManagementDatabaseName>
<BizTalkManagementDatabaseConnectionString>
server=$(BizTalkDatabaseServerName);
database=$(BizTalkManagementDatabaseName);
integrated security=sspi;
</BizTalkManagementDatabaseConnectionString>
<PipelineComponentsFolderPath>C:\Program Files\Microsoft BizTalk Server 2010\Pipeline Components</PipelineComponentsFolderPath>
You could easily override these Property values by using the commandline or by adding additional msbuild arguments in VS or TeamBuild using the Property switch
msbuild.exe MyBizTalkProject.proj /p:BizTalkDatabaseServerName=SqlCluster
The developer of this project should rewrite the default MSBuild.Custom.properties file to look like this
<BizTalkDatabaseServerName Condition="'$(BizTalkDatabaseServerName)'==''">.</BizTalkDatabaseServerName>
By using this approach the "." identifier (for local SQL Server) will only be used when no value for the parameter is given. Because with the current implementation the definition of the Property could! override you value passed from the command line. So be aware of that.