Select Page

1. Mount you site’s web folder on you development computer

2. create VS Project anywhere on your computer

3. IMPORTANT: remove web.conf file – if you leave it in place and compile you solution, the original web.confing, found in website root, will be replaced with one in your project

4. add reference to Sitecore.Kernel or any other assembly you may need in your project

5. Add new configuration xml file. This file should have path to website folder

SitecoreBinPath – Location of Sitecore Binaries –

DeployCodePath – difefrent from above for a reason; this way you can refference differnt version of kernel (for example) to test upgradeability of your code or for any other reason where you website root is different from source of Sitecore DLLs

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SitecoreBinPath>Y:\IMSTEK\Website</SitecoreBinPath>
<DeployCodePath>Y:\IMSTEK\Website</DeployCodePath>
</PropertyGroup>
</Project>

</configuration>

 

6. Unload project, right click on the project and select ‘Unload Project’

7. Edit unloaded project, right click on the pojct (after it’s been unloaded) and select Edit PROJECTNAME.

project1

<Import Project="path.local.xml" Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU' and Exists('path.local.xml')" />

8. Fix reference to Sitecore.Kernel, replace absolute path with :

<HintPath>$(SitecoreBinPath)\bin\Sitecore.Kernel.dll</HintPath>

project-21-300x44

9. Add target AfterBuild section. This section would grantee deployment of you binaries and .config files, with exclusion of xml (in my case, i needed all xml to be excluded from deployment , but you may need to change t just preventing loca.pth.xml from being deployed )

project-31-300x144

 

<Target Name="AfterBuild" Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<ItemGroup>
<Content Remove="@(Content)" Condition="'%(Extension)' == '.xml'" />
</ItemGroup>
<CreateItem Include="$(OutputPath)\*">
<Output TaskParameter="Include" ItemName="Binaries" />
</CreateItem>
<Copy SourceFiles="@(Binaries)" DestinationFolder="$(DeployCodePath)\bin" />
<Copy SourceFiles="@(Content)" DestinationFolder="$(DeployCodePath)\%(Content.RelativeDir)" />
</Target>

 

10. repeat the 5-9 steps to add deployment to Integration or Prod. I recoment using CI server, like TeamCity to handle deployment from SVN to Integration/QA/Prod

 

Debug Code

1. On you remote server start remote debugger

project-4-300x111

2. Add breakpoint, build project and in you visual Studio Attached to Process:

 

project-5-300x204