|
|
(Uma revisão intermediária pelo mesmo usuário não estão sendo mostradas) |
Linha 1: |
Linha 1: |
− | Esta página tem como objetivo orientar os colaboradores na correta configuração do Build utilizando a plataforma Jenkins para os projetos que usam .NET. | + | Esta página tem como objetivo orientar os colaboradores na correta configuração do Build utilizando o Jenkins para os projetos desenvolvidos em .NET. |
− | Para tanto, algumas alterações no projeto são necessárias para que o Build possa ser executado utilizando-se o próprio ''MSBUILD'', e não a versão do Visual Studio no qual o sistema foi desenvolvido.
| + | |
| | | |
− | == Alterações necessárias no Projeto ==
| + | O novo modelo de Build adotado pela MSTech encontra-se disponível no link: [//gitlab.mstech.com.br/build-dotnet/cake-mstech/wikis/home Manual do Build/Jenkins] |
− | | + | |
− | === Arquivos ''*.csproj'' ===
| + | |
− | Nos arquivos do projeto com extensão .csproj é necessário localizar e comentar o seguinte bloco:
| + | |
− | | + | |
− | <syntaxhighlight lang="xml" line="1" >
| + | |
− | <PropertyGroup>
| + | |
− | <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
| + | |
− | <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
| + | |
− | </PropertyGroup>
| + | |
− | </syntaxhighlight>
| + | |
− | | + | |
− | No exemplo acima, o sistema foi desenvolvido utilizando a versão 10.0 do Visual Studio, e para que o MSBUILD possa compilar o projeto faz-se necessário comentar ou remover o bloco <PropertyGroup>.
| + | |
− | | + | |
− | === Version.xml ===
| + | |
− | | + | |
− | É necessário alterar a estrutura do arquivo ''version.xml'' para atender a necessidade do sistema de build. Vale ressaltar que, como alguns sistemas fazem a leitura deste arquivo, faz-se necessária a alteração no sistema para efetuar a correta leitura do novo arquivo.
| + | |
− | | + | |
− | Arquivo antigo:
| + | |
− | <syntaxhighlight lang="xml" line="1" >
| + | |
− | <?xml version="1.0" encoding="utf-8"?>
| + | |
− | <configuration>
| + | |
− | <versionNumber>
| + | |
− | <Major value="5" />
| + | |
− | <Minor value="5" />
| + | |
− | <Revision value="7" />
| + | |
− | <Build value="1" />
| + | |
− | </versionNumber>
| + | |
− | </configuration>
| + | |
− | </syntaxhighlight>
| + | |
− | | + | |
− | Arquivo novo:
| + | |
− | <syntaxhighlight lang="xml" line="1" >
| + | |
− | <?xml version="1.0" encoding="utf-8"?>
| + | |
− | <Project
| + | |
− | ToolsVersion="4.0"
| + | |
− | DefaultTargets="Default"
| + | |
− | xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
| + | |
− | <PropertyGroup>
| + | |
− | <Major>5</Major>
| + | |
− | <Minor>5</Minor>
| + | |
− | <Revision>7</Revision>
| + | |
− | <Build>1</Build>
| + | |
− | </PropertyGroup>
| + | |
− | </Project>
| + | |
− | </syntaxhighlight>
| + | |
− | | + | |
− | === Zip.targets ===
| + | |
− | | + | |
− | É necessário incluir na raiz da solução o arquivo ''Zip.targets'', que é responsável por compactar o pacote com o número da versão constante no arquivo ''version.xml''.
| + | |
− | * Nota: A extensão do arquivo é .targets
| + | |
− | | + | |
− | Conteúdo do arquivo zip.targets
| + | |
− | | + | |
− | <syntaxhighlight lang="xml" line="1" >
| + | |
− | <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
| + | |
− | | + | |
− | <!-- Simple ZIP task that utilize .NET 4.5 Zip Compression -->
| + | |
− | <!--
| + | |
− | Example
| + | |
− | <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
| + | |
− | ToolsVersion="4.0" DefaultTargets="Sample" >
| + | |
− | <Import Project="Zip.targets" />
| + | |
− | <Target Name="Sample" >
| + | |
− | <Zip SourceFolder="C:\SomeFolder\" OutputFileName="output.zip" />
| + | |
− | </Target>
| + | |
− | </Project>
| + | |
− | you can run this project with msbuild
| + | |
− | -->
| + | |
− | <UsingTask TaskName="Zip" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
| + | |
− | <ParameterGroup>
| + | |
− | <SourceFolder ParameterType="System.String" Required="true"/>
| + | |
− | <OutputFileName ParameterType="System.String" Required="true" />
| + | |
− | <NoBackup ParameterType="System.Boolean" Required="false" />
| + | |
− | </ParameterGroup>
| + | |
− | <Task>
| + | |
− | <Reference Include="System.Core" />
| + | |
− | <Reference Include="Microsoft.CSharp" />
| + | |
− | <Reference Include="System.IO.Compression" />
| + | |
− | <Reference Include="System.IO.Compression.FileSystem" />
| + | |
− | <Using Namespace="System" />
| + | |
− | <Using Namespace="System.IO" />
| + | |
− | <Using Namespace="System.Net" />
| + | |
− | <Using Namespace="System.Linq" />
| + | |
− | <Using Namespace="System.Reflection" />
| + | |
− | <Using Namespace="Microsoft.Build.Framework" />
| + | |
− | <Using Namespace="Microsoft.Build.Utilities" />
| + | |
− | <Using Namespace="System.IO.Compression" />
| + | |
− | <Code Type="Fragment" Language="cs">
| + | |
− | <![CDATA[
| + | |
− | try {
| + | |
− | SourceFolder = Path.GetFullPath(SourceFolder);
| + | |
− | OutputFileName = Path.GetFullPath(OutputFileName);
| + | |
− |
| + | |
− | Log.LogMessage("Package zip... (" + OutputFileName + " )");
| + | |
− |
| + | |
− | // Prepare output temp file
| + | |
− | var tmpFile = Path.ChangeExtension(OutputFileName, ".zip.tmp");
| + | |
− | File.Delete(tmpFile);
| + | |
− | // Zip folder
| + | |
− | ZipFile.CreateFromDirectory(SourceFolder, tmpFile);
| + | |
− | // Replace output file
| + | |
− | File.Delete(OutputFileName);
| + | |
− | File.Move(tmpFile, OutputFileName);
| + | |
− | return true;
| + | |
− | }
| + | |
− | catch (Exception ex) {
| + | |
− | Log.LogErrorFromException(ex);
| + | |
− | return false;
| + | |
− | }
| + | |
− | ]]>
| + | |
− | </Code>
| + | |
− | </Task>
| + | |
− | </UsingTask>
| + | |
− | </Project>
| + | |
− | </syntaxhighlight>
| + | |
− | | + | |
− | === Build.xml ===
| + | |
− | | + | |
− | Todo o processo de ''Build'' está atrelado ao arquivo ''build.xml'' desenvolvido para orquestrar a execução do ''build'' dos sistemas em .NET.
| + | |
− | Este arquivo deve estar na raiz da solução.
| + | |
− | | + | |
− | A estrutura do arquivo é a seguinte:
| + | |
− | <syntaxhighlight lang="xml" line="1" >
| + | |
− | <?xml version="1.0" encoding="utf-8"?>
| + | |
− | <Project
| + | |
− | ToolsVersion="4.0"
| + | |
− | DefaultTargets="Compile"
| + | |
− | xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
| + | |
− |
| + | |
− | <!-- CLASSE NECESSÁRIA PARA REALIZAR O ZIP DOS ARQUIVOS, CASO MUDAR A ESTRUTURA PRECISA ATUALIZAR O CAMINHO DE ONDE VAI FICAR -->
| + | |
− | <Import Project="Zip.targets" />
| + | |
− |
| + | |
− | <PropertyGroup>
| + | |
− | <!-- NOME DA APLICAÇÃO [SITE] -->
| + | |
− | <ProjectName>NomeDoSite</ProjectName>
| + | |
− |
| + | |
− | <!-- DIRETÓRIO DA APLICAÇÃO RAIZ -->
| + | |
− | <ProjectDir>$(ProjectName)\</ProjectDir>
| + | |
− |
| + | |
− | <!-- NOME DO CSPROJ DA APLICAÇÃO [SITE], CASO O NOME NÃO FOR O MESMO DO <PROJECTNAME> ALTERAR -->
| + | |
− | <CSProjName>$(ProjectName).csproj</CSProjName>
| + | |
− |
| + | |
− | <!-- CAMINHO DE ONDE ESTÁ O ARQUIVO CSPROJ DA SOLUÇÃO [SITE] -->
| + | |
− | <ProjectPath>$(ProjectDir)$(CSProjName)</ProjectPath>
| + | |
− |
| + | |
− | <!-- PASTA AUXILIAR PARA JOGAR A COMPILAÇÃO, ZIPAR E NO FIM É EXCLUIDA -->
| + | |
− | <TargetDir>PackageBuild\</TargetDir>
| + | |
− |
| + | |
− | <!-- PASTA DEFAULT ONDE SERÁ COLOCADO AS DLL APÓS A COMPILAÇÃO DENTRO DO DIRETÓRIO AUXILIAR -->
| + | |
− | <TargetBinDir>$(TargetDir)\bin</TargetBinDir>
| + | |
− |
| + | |
− | <!-- ONDE VAI FICAR O ZIP DO BUILD -->
| + | |
− | <TargetBuildZip>Builds</TargetBuildZip>
| + | |
− | | + | |
− | <!-- NÃO ALTERAR -->
| + | |
− | <Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
| + | |
− | <BuildPlatform Condition=" '$(BuildPlatform)' == '' ">Any CPU</BuildPlatform>
| + | |
− | </PropertyGroup>
| + | |
− |
| + | |
− | <ItemGroup>
| + | |
− | <BuildArtifactsDir Include="$(TargetBinDir)\" />
| + | |
− | <ProjectsToBuild Include="$(ProjectDir)\$(CSProjName)"/>
| + | |
− | </ItemGroup>
| + | |
− |
| + | |
− | <Import Project="$(ProjectDir)\version.xml" />
| + | |
− |
| + | |
− | <!-- LIMPA OS REGISTROS CASO EXISTA, E CRIA A PASTA PADRÃO ONDE FICARÁ OS ZIP -->
| + | |
− | <Target Name="Clean">
| + | |
− | <MakeDir Directories="$(TargetBuildZip)"/>
| + | |
− | <RemoveDir Directories="$(TargetDir)" />
| + | |
− | </Target>
| + | |
− |
| + | |
− | <!-- COPIA OS ARQUIVOS NECESSÁRIOS DO SITE [ITEMS QUE ESTÁ DENTRO DO CSPROJ ex:(<Content Include="Administracao\Configuracoes\Configuracao\Busca.aspx" />)] -->
| + | |
− | <Target Name="CopyProject" DependsOnTargets="Clean">
| + | |
− | <!-- Get list of CS and RES files -->
| + | |
− | <XmlPeek
| + | |
− | Namespaces="<Namespace Prefix='msb' Uri='http://schemas.microsoft.com/developer/msbuild/2003'/>"
| + | |
− | XmlInputPath="$(ProjectPath)"
| + | |
− | Query="/msb:Project/msb:ItemGroup/msb:Content/@Include|/msb:Project/msb:ItemGroup/msb:EmbeddedResource/@Include">
| + | |
− | | + | |
− | <Output TaskParameter="Result" ItemName="Peeked" />
| + | |
− | | + | |
− | </XmlPeek>
| + | |
− | <!-- Copy source and resource files -->
| + | |
− | <Copy
| + | |
− | SourceFiles="@(Peeked->'$(ProjectDir)%(RelativeDir)%(Filename)%(Extension)')"
| + | |
− | DestinationFiles="@(Peeked->'$(TargetDir)%(RelativeDir)%(Filename)%(Extension)')"/>
| + | |
− | <!-- Copy project file -->
| + | |
− | <Copy
| + | |
− | SourceFiles="$(ProjectPath)"
| + | |
− | DestinationFiles="$(ProjectDir)$(CSProjName)"/>
| + | |
− | | + | |
− | <MSBuild Projects="$(ProjectDir)$(CSProjName)"/>
| + | |
− | | + | |
− | </Target>
| + | |
− |
| + | |
− | <!-- LIMPA A PASTA BIN DA PASTA AUXILIAR CASO EXISTA -->
| + | |
− | <Target Name="CleanBin" DependsOnTargets="CopyProject">
| + | |
− | <RemoveDir Directories="$(TargetBinDir)" />
| + | |
− | </Target>
| + | |
− |
| + | |
− | <!-- REALIZA O BUILD DA SOLUÇÃO GERANDO AS DLL's -->
| + | |
− | <Target Name="BuildCompile" DependsOnTargets="CleanBin">
| + | |
− | <MSBuild Projects="@(ProjectsToBuild)" Targets="Rebuild"
| + | |
− | Properties="outdir=%(BuildArtifactsDir.FullPath);Configuration=$(Configuration)" />
| + | |
− | </Target>
| + | |
− |
| + | |
− | <!-- REALIZA O ZIP DA PASTA AUXILIAR E JOGA PARA A PASTA PADRÃO ONDE FICARÁ O ZIP -->
| + | |
− | <Target Name="Zip" DependsOnTargets="BuildCompile" >
| + | |
− | <Zip SourceFolder="$(TargetDir)" OutputFileName="$(TargetBuildZip)\$(ProjectName)_$(Major).$(Minor).$(Revision).$(Build).zip" />
| + | |
− | </Target>
| + | |
− |
| + | |
− | <!-- APAGA A PASTA AUXILIAR -->
| + | |
− | <Target Name="Compile" DependsOnTargets="Zip">
| + | |
− | <RemoveDir Directories="$(TargetDir)" />
| + | |
− | </Target>
| + | |
− | | + | |
− | </Project>
| + | |
− | </syntaxhighlight>
| + | |
− | | + | |
− | == Alterações sugeridas ==
| + | |
− | | + | |
− | === Web.config ===
| + | |
− | Atualmente o web.config do site não é armazenado juntamente com o projeto, pois o mesmo "varia" de acordo com cada cliente. Uma forma de permitir esse armazenamento do web.config no projeto é alterar a sua estrutura, criando arquivos adicionais que são invocados pelo mesmo, mas estão protegidos em outra pasta. Desta forma, o web.config pode ser um arquivo padrão, sendo que os parâmetros de cada cliente estarão em arquivos individuais.
| + | |
− | | + | |
− | Para tanto, precisamos remover todas as configurações individuais do arquivo "web.config". Abaixo, um exemplo de um arquivo utilizado em um dos projetos da MSTECH que segue esse padrão:
| + | |
− | | + | |
− | <syntaxhighlight lang="xml" line="1" >
| + | |
− | <?xml version="1.0"?>
| + | |
− | <!--
| + | |
− | For more information on how to configure your ASP.NET application, please visit
| + | |
− | http://go.microsoft.com/fwlink/?LinkId=301879
| + | |
− | -->
| + | |
− | <configuration>
| + | |
− | <configSections>
| + | |
− | <!--SAML config section-->
| + | |
− | <section name="ServiceProvider" type="MSTech.SAML20.Configuration.ConfigurationReader, MSTech.SAML20"/>
| + | |
− | <!-- Log4net config section -->
| + | |
− | <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
| + | |
− | <!-- FileStorage config section -->
| + | |
− | <section name="fileStorage" type="MSTech.FileStorage.Core.FileSystemConfiguration, MSTech.FileStorage.Core"/>
| + | |
− | <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
| + | |
− | <!-- 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"/>
| + | |
− | <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
| + | |
− | </configSections>
| + | |
− | <!--SAML config source-->
| + | |
− | <ServiceProvider configSource="Configs\saml.config"/>
| + | |
− | <!-- log4net config source -->
| + | |
− | <log4net configSource="Configs\log4net.config"/>
| + | |
− | <!-- fileStorage source -->
| + | |
− | <fileStorage configSource="Configs\filestorage.config"/>
| + | |
− | <!-- connectionStrings source -->
| + | |
− | <!--<connectionStrings configSource="Configs\connection.config"></connectionStrings>-->
| + | |
− | <appSettings>
| + | |
− | <add key="bundle:EnableOptimizations" value="false"/>
| + | |
− | <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="log4net.Internal.Debug" value="true"/>
| + | |
− | <add key="aspnet:MaxJsonDeserializerMembers" value="10000"/>
| + | |
− | </appSettings>
| + | |
− | <system.web>
| + | |
− | <!--"forms": -->
| + | |
− | <authentication mode="Forms">
| + | |
− | <forms name="3FB22D4A-6407-454E-B66F-000F2FFD1ECE" cookieless="UseCookies" timeout="60" protection="All" slidingExpiration="true" loginUrl="Account/LogoutSSO" path="/"/>
| + | |
− | </authentication>
| + | |
− | <!--"sessionState": -->
| + | |
− | <sessionState cookieName="F740F707-D127-412E-A34F-000F24A6CD37" cookieless="UseCookies" timeout="60" mode="InProc"/>
| + | |
− | <!--"customErrors": Habilitar página de erro personalizada -->
| + | |
− | <!--<customErrors mode="On" />-->
| + | |
− | <customErrors mode="RemoteOnly"/>
| + | |
− | <httpRuntime targetFramework="4.5" maxRequestLength="10000"/>
| + | |
− | <!-- Performance: Buffer -->
| + | |
− | <pages buffer="true" enableViewState="false"/>
| + | |
− | <!--"caching": Configura o cache de saída -->
| + | |
− | <!-- CacheDay = 1d -->
| + | |
− | <!-- CacheHour = 1h -->
| + | |
− | <caching>
| + | |
− | <outputCache enableOutputCache="false"/>
| + | |
− | <outputCacheSettings>
| + | |
− | <outputCacheProfiles>
| + | |
− | <add name="CacheDay" duration="86400" varyByParam="*"/>
| + | |
− | <add name="CacheHour" duration="3600" varyByParam="*" enabled="false"/>
| + | |
− | </outputCacheProfiles>
| + | |
− | </outputCacheSettings>
| + | |
− | </caching>
| + | |
− | <machineKey decryption="Auto" decryptionKey="CDC7A465F34F652CD3FA574A7214C1836799D4D960554801" validationKey="CF0EE132931281163550B2297B017030712EB1AFDE85FDF7844F244651785EB636FD0A3A2B2DBA0EB377A51E60901329B7BA717994D295351B35503E100C68D8"/>
| + | |
− | <compilation debug="true"/>
| + | |
− | </system.web>
| + | |
− | <runtime>
| + | |
− | <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
| + | |
− | <dependentAssembly>
| + | |
− | <assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed"/>
| + | |
− | <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0"/>
| + | |
− | </dependentAssembly>
| + | |
− | <dependentAssembly>
| + | |
− | <assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35"/>
| + | |
− | <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0"/>
| + | |
− | </dependentAssembly>
| + | |
− | <dependentAssembly>
| + | |
− | <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35"/>
| + | |
− | <bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930"/>
| + | |
− | </dependentAssembly>
| + | |
− | <dependentAssembly>
| + | |
− | <assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral"/>
| + | |
− | <bindingRedirect oldVersion="0.0.0.0-1.2.15.0" newVersion="1.2.15.0"/>
| + | |
− | </dependentAssembly>
| + | |
− | <dependentAssembly>
| + | |
− | <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
| + | |
− | <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0"/>
| + | |
− | </dependentAssembly>
| + | |
− | <dependentAssembly>
| + | |
− | <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
| + | |
− | <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
| + | |
− | </dependentAssembly>
| + | |
− | <dependentAssembly>
| + | |
− | <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
| + | |
− | <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
| + | |
− | </dependentAssembly>
| + | |
− | <dependentAssembly>
| + | |
− | <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
| + | |
− | <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0"/>
| + | |
− | </dependentAssembly>
| + | |
− | <dependentAssembly>
| + | |
− | <assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" culture="neutral"/>
| + | |
− | <bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2"/>
| + | |
− | </dependentAssembly>
| + | |
− | <dependentAssembly>
| + | |
− | <assemblyIdentity name="Microsoft.VisualStudio.Enterprise.AspNetHelper" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
| + | |
− | <codeBase version="12.0.0.0" href="file:///C:/Program%20Files%20(x86)/Microsoft%20Visual%20Studio%2012.0/Common7/IDE/PrivateAssemblies/Microsoft.VisualStudio.Enterprise.AspNetHelper.DLL"/>
| + | |
− | </dependentAssembly>
| + | |
− | </assemblyBinding>
| + | |
− | </runtime>
| + | |
− | <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>
| + | |
− | <system.webServer>
| + | |
− | <!-- PassThrough – If existingResponse is seen as “PassThrough”,
| + | |
− | custom error module will always pass through responses from modules.
| + | |
− | This setting will make custom error module return blank response if modules don’t set any text.-->
| + | |
− | <httpErrors existingResponse="PassThrough"/>
| + | |
− | <!-- Performance: Compressão de arquivos dinâmicos, estáticos e antes de enviar para OutPutCache-->
| + | |
− | <urlCompression doDynamicCompression="true" doStaticCompression="true" dynamicCompressionBeforeCache="true"/>
| + | |
− | <!-- Performance: Cache de conteúdo estático 1 hora-->
| + | |
− | <staticContent>
| + | |
− | <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="1.00:00:00"/>
| + | |
− | </staticContent>
| + | |
− | </system.webServer>
| + | |
− | </configuration>
| + | |
− | </syntaxhighlight>
| + | |
− | | + | |
− | Os arquivos relacionados com esse sistema são:
| + | |
− | | + | |
− | ==== saml.config ====
| + | |
− | <syntaxhighlight lang="xml" line="1" >
| + | |
− | <ServiceProvider id="http://localhost:59494/Account" xmlns="urn:MSTech.SAML20.Configuration">
| + | |
− | | + | |
− | <ServiceEndpoint type="signon" localpath="http://localhost:59494/Home" redirectUrl="http://localhost:54296/SAML/Signon.aspx">
| + | |
− | <SigningCertificate keyFile="~/samlcert.pfx" password="YS2OglvxHMwaTWXkzeTOTw==" />
| + | |
− | </ServiceEndpoint>
| + | |
− | <ServiceEndpoint type="logout" localpath="http://localhost:59494/Account/LogoutSSO" redirectUrl="http://localhost:54296/Logout.ashx" />
| + | |
− | </ServiceProvider>
| + | |
− | </syntaxhighlight>
| + | |
− | | + | |
− | ==== log4net.config ====
| + | |
− | <syntaxhighlight lang="xml" line="1" >
| + | |
− | <log4net debug="true">
| + | |
− | | + | |
− | <logger name="Errors">
| + | |
− | <level value="ALL"/>
| + | |
− | <appender-ref ref="AdoNetAppender_LogError"/>
| + | |
− | </logger>
| + | |
− | | + | |
− | <logger name="Activity">
| + | |
− | <level value="ALL"/>
| + | |
− | <appender-ref ref="AdoNetAppender_LogActivity"/>
| + | |
− | </logger>
| + | |
− | | + | |
− | <appender name="AdoNetAppender_LogError" type="log4net.Appender.AdoNetAppender">
| + | |
− | <bufferSize value="1" />
| + | |
− | <connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
| + | |
− | <commandText value="INSERT INTO LogError ([Date],[Level],[Logger],[Message],[Exception],[Browser],[HostName],[UserHostAddress],[QueryString],[FilePath],[Identity],[Plataform],[MobileDeviceModel]) VALUES (@log_date,@log_level,@logger,@message,@exception,@Browser,@HostName,@UserHostAddress,@QueryString,@FilePath,@Identity,@Plataform,@MobileDeviceModel)" />
| + | |
− | <parameter>
| + | |
− | <parameterName value="@log_date"/>
| + | |
− | <dbType value="DateTime"/>
| + | |
− | <layout type="log4net.Layout.RawTimeStampLayout"/>
| + | |
− | </parameter>
| + | |
− | <parameter>
| + | |
− | <parameterName value="@log_level"/>
| + | |
− | <dbType value="String"/>
| + | |
− | <size value="50"/>
| + | |
− | <layout type="log4net.Layout.PatternLayout">
| + | |
− | <conversionPattern value="%level"/>
| + | |
− | </layout>
| + | |
− | </parameter>
| + | |
− | <parameter>
| + | |
− | <parameterName value="@logger"/>
| + | |
− | <dbType value="String"/>
| + | |
− | <size value="255"/>
| + | |
− | <layout type="log4net.Layout.PatternLayout">
| + | |
− | <conversionPattern value="%logger"/>
| + | |
− | </layout>
| + | |
− | </parameter>
| + | |
− | <parameter>
| + | |
− | <parameterName value="@message"/>
| + | |
− | <dbType value="String"/>
| + | |
− | <size value="4000"/>
| + | |
− | <layout type="log4net.Layout.PatternLayout">
| + | |
− | <conversionPattern value="%message"/>
| + | |
− | </layout>
| + | |
− | </parameter>
| + | |
− | <parameter>
| + | |
− | <parameterName value="@exception"/>
| + | |
− | <dbType value="String"/>
| + | |
− | <size value="8000"/>
| + | |
− | <layout type="log4net.Layout.ExceptionLayout"/>
| + | |
− | </parameter>
| + | |
− | <parameter>
| + | |
− | <parameterName value="@Browser"/>
| + | |
− | <dbType value="String"/>
| + | |
− | <size value="250"/>
| + | |
− | <layout type="log4net.Layout.PatternLayout">
| + | |
− | <conversionPattern value="%property{Browser}"/>
| + | |
− | </layout>
| + | |
− | </parameter>
| + | |
− | <parameter>
| + | |
− | <parameterName value="@HostName"/>
| + | |
− | <dbType value="String"/>
| + | |
− | <size value="500"/>
| + | |
− | <layout type="log4net.Layout.PatternLayout">
| + | |
− | <conversionPattern value="%property{HostName}"/>
| + | |
− | </layout>
| + | |
− | </parameter>
| + | |
− | <parameter>
| + | |
− | <parametername value="@UserHostAddress"/>
| + | |
− | <dbtype value="string"/>
| + | |
− | <size value="500"/>
| + | |
− | <layout type="log4net.layout.patternlayout">
| + | |
− | <conversionpattern value="%property{UserHostAddress}"/>
| + | |
− | </layout>
| + | |
− | </parameter>
| + | |
− | <parameter>
| + | |
− | <parametername value="@QueryString"/>
| + | |
− | <dbtype value="string"/>
| + | |
− | <size value="500"/>
| + | |
− | <layout type="log4net.layout.patternlayout">
| + | |
− | <conversionpattern value="%property{QueryString}"/>
| + | |
− | </layout>
| + | |
− | </parameter>
| + | |
− | <parameter>
| + | |
− | <parametername value="@FilePath"/>
| + | |
− | <dbtype value="string"/>
| + | |
− | <size value="250"/>
| + | |
− | <layout type="log4net.layout.patternlayout">
| + | |
− | <conversionpattern value="%property{FilePath}"/>
| + | |
− | </layout>
| + | |
− | </parameter>
| + | |
− | <parameter>
| + | |
− | <parametername value="@Identity"/>
| + | |
− | <dbtype value="string"/>
| + | |
− | <size value="250"/>
| + | |
− | <layout type="log4net.layout.patternlayout">
| + | |
− | <conversionpattern value="%property{Identity}"/>
| + | |
− | </layout>
| + | |
− | </parameter>
| + | |
− | <parameter>
| + | |
− | <parametername value="@Plataform"/>
| + | |
− | <dbtype value="string"/>
| + | |
− | <size value="250"/>
| + | |
− | <layout type="log4net.layout.patternlayout">
| + | |
− | <conversionpattern value="%property{Plataform}"/>
| + | |
− | </layout>
| + | |
− | </parameter>
| + | |
− | <parameter>
| + | |
− | <parametername value="@MobileDeviceModel"/>
| + | |
− | <dbtype value="string"/>
| + | |
− | <size value="250"/>
| + | |
− | <layout type="log4net.layout.patternlayout">
| + | |
− | <conversionpattern value="%property{MobileDeviceModel}"/>
| + | |
− | </layout>
| + | |
− | </parameter>
| + | |
− | </appender>
| + | |
− | | + | |
− | <appender name="AdoNetAppender_LogActivity" type="log4net.Appender.AdoNetAppender">
| + | |
− | <bufferSize value="1" />
| + | |
− | <connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
| + | |
− | <commandText value="INSERT INTO LogActivity ([Date],[Message],[Action],[Browser],[HostName],[UserHostAddress],[QueryString],[FilePath],[Identity],[Plataform],[MobileDeviceModel]) VALUES (@log_date,@Message,@Action,@Browser,@HostName,@UserHostAddress,@QueryString,@FilePath,@Identity,@Plataform,@MobileDeviceModel)" />
| + | |
− | <parameter>
| + | |
− | <parameterName value="@log_date"/>
| + | |
− | <dbType value="DateTime"/>
| + | |
− | <layout type="log4net.Layout.RawTimeStampLayout"/>
| + | |
− | </parameter>
| + | |
− | <parameter>
| + | |
− | <parameterName value="@message"/>
| + | |
− | <dbType value="String"/>
| + | |
− | <size value="4000"/>
| + | |
− | <layout type="log4net.Layout.PatternLayout">
| + | |
− | <conversionPattern value="%message"/>
| + | |
− | </layout>
| + | |
− | </parameter>
| + | |
− | <parameter>
| + | |
− | <parameterName value="@Action"/>
| + | |
− | <dbType value="String"/>
| + | |
− | <size value="30"/>
| + | |
− | <layout type="log4net.Layout.PatternLayout">
| + | |
− | <conversionPattern value="%property{Action}"/>
| + | |
− | </layout>
| + | |
− | </parameter>
| + | |
− | <parameter>
| + | |
− | <parameterName value="@Browser"/>
| + | |
− | <dbType value="String"/>
| + | |
− | <size value="250"/>
| + | |
− | <layout type="log4net.Layout.PatternLayout">
| + | |
− | <conversionPattern value="%property{Browser}"/>
| + | |
− | </layout>
| + | |
− | </parameter>
| + | |
− | <parameter>
| + | |
− | <parameterName value="@HostName"/>
| + | |
− | <dbType value="String"/>
| + | |
− | <size value="500"/>
| + | |
− | <layout type="log4net.Layout.PatternLayout">
| + | |
− | <conversionPattern value="%property{HostName}"/>
| + | |
− | </layout>
| + | |
− | </parameter>
| + | |
− | <parameter>
| + | |
− | <parameterName value="@UserHostAddress"/>
| + | |
− | <dbType value="String"/>
| + | |
− | <size value="500"/>
| + | |
− | <layout type="log4net.Layout.PatternLayout">
| + | |
− | <conversionPattern value="%property{UserHostAddress}"/>
| + | |
− | </layout>
| + | |
− | </parameter>
| + | |
− | <parameter>
| + | |
− | <parameterName value="@QueryString"/>
| + | |
− | <dbType value="String"/>
| + | |
− | <size value="500"/>
| + | |
− | <layout type="log4net.Layout.PatternLayout">
| + | |
− | <conversionPattern value="%property{QueryString}"/>
| + | |
− | </layout>
| + | |
− | </parameter>
| + | |
− | <parameter>
| + | |
− | <parameterName value="@FilePath"/>
| + | |
− | <dbType value="String"/>
| + | |
− | <size value="250"/>
| + | |
− | <layout type="log4net.Layout.PatternLayout">
| + | |
− | <conversionPattern value="%property{FilePath}"/>
| + | |
− | </layout>
| + | |
− | </parameter>
| + | |
− | <parameter>
| + | |
− | <parameterName value="@Identity"/>
| + | |
− | <dbType value="String"/>
| + | |
− | <size value="250"/>
| + | |
− | <layout type="log4net.Layout.PatternLayout">
| + | |
− | <conversionPattern value="%property{Identity}"/>
| + | |
− | </layout>
| + | |
− | </parameter>
| + | |
− | <parameter>
| + | |
− | <parameterName value="@Plataform"/>
| + | |
− | <dbType value="String"/>
| + | |
− | <size value="250"/>
| + | |
− | <layout type="log4net.Layout.PatternLayout">
| + | |
− | <conversionPattern value="%property{Plataform}"/>
| + | |
− | </layout>
| + | |
− | </parameter>
| + | |
− | <parameter>
| + | |
− | <parameterName value="@MobileDeviceModel"/>
| + | |
− | <dbType value="String"/>
| + | |
− | <size value="250"/>
| + | |
− | <layout type="log4net.Layout.PatternLayout">
| + | |
− | <conversionPattern value="%property{MobileDeviceModel}"/>
| + | |
− | </layout>
| + | |
− | </parameter>
| + | |
− | </appender>
| + | |
− | | + | |
− | <!--<root>
| + | |
− | <level value="DEBUG" />
| + | |
− | <appender-ref ref="AdoNetAppender_LogError" />
| + | |
− | <appender-ref ref="AdoNetAppender_LogActivity" />
| + | |
− | </root>-->
| + | |
− | | + | |
− | </log4net>
| + | |
− | </syntaxhighlight>
| + | |
− | | + | |
− | ==== filestorage ====
| + | |
− | <syntaxhighlight lang="xml" line="1" >
| + | |
− | <!-- Quando utilizado o diretório virtual, necessário que o mesmo faça referência para ao diretório
| + | |
− | <fileStorage directory="Files" virtualDirectoryAlias="Files" />
| + | |
− | -->
| + | |
− | <fileStorage directory="Files" virtualDirectoryAlias="" />
| + | |
− | </syntaxhighlight>
| + | |
− | | + | |
− | ==== connection.config ====
| + | |
− | <syntaxhighlight lang="xml" line="1" >
| + | |
− | <connectionStrings>
| + | |
− | <add name="GestaoFinanceira.LogMongoDB" connectionString="mongodb://devedu-nodejs:27017/GestaoFinanceira" />
| + | |
− | </connectionStrings>
| + | |
− | | + | |
− | </syntaxhighlight>
| + | |
− | | + | |
− | == Configurando o Build no Jenkins ==
| + | |
Esta página tem como objetivo orientar os colaboradores na correta configuração do Build utilizando o Jenkins para os projetos desenvolvidos em .NET.