I have a GIT repository and I'm using Umbraco. Once strange thing that was happening to me were my files in the css folder kept on being modified even though I wasn't changing them. So every time I wanted to commit a change I'd have to undo the css file changes.
I thought this was Umbraco and because I had my style sheet linked to the rich text editor datatype, but it turned out to be the uSync package. I was synchronizing Stylesheets so by turning this off in the uSyncSettings.config file this stopped the problem. I don't need uSync to manage these files for me.
Monday, 31 March 2014
Umbraco Relationships Datatype
This is a great Umbraco package that helps manage node relationships in multilingual websites. It's just what I was looking for:
Vizioz Relationships Datatype for Umbraco
Vizioz Relationships Datatype for Umbraco
Labels:
Datatype,
Multilingual,
Relations,
Relationships,
umbraco
Wednesday, 19 March 2014
Umbraco fails to Publish! We get an exception within a load balanced environment.
After a deployment to our live servers which are load balanced we could not Publish. We could Save but not right-click publish or by clicking on the icon.
This was the error:
ERROR Umbraco.Web.UmbracoApplication - [Thread 36] An unhandled exception occurred
System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.TypeInitializationException: The type initializer for 'umbraco.presentation.cache.dispatcher' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at umbraco.presentation.cache.dispatcher..cctor()
--- End of inner exception stack trace ---
at umbraco.presentation.cache.dispatcher.Refresh(Guid factoryGuid, Int32 Id)
at umbraco.library.UpdateDocumentCache(Document doc)
at umbraco.cms.presentation.editContent.Publish(Object sender, EventArgs e)
at System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e)
at System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
This seemed to be an error with the distributed call from server 1 to server 2 in the load balancer.
This was the error:
ERROR Umbraco.Web.UmbracoApplication - [Thread 36] An unhandled exception occurred
System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.TypeInitializationException: The type initializer for 'umbraco.presentation.cache.dispatcher' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at umbraco.presentation.cache.dispatcher..cctor()
--- End of inner exception stack trace ---
at umbraco.presentation.cache.dispatcher.Refresh(Guid factoryGuid, Int32 Id)
at umbraco.library.UpdateDocumentCache(Document doc)
at umbraco.cms.presentation.editContent.Publish(Object sender, EventArgs e)
at System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e)
at System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
This seemed to be an error with the distributed call from server 1 to server 2 in the load balancer.
- First I thought it might be a rewrite rule in \config\UrlRewriting.config - it wasn't
- Then I recycled the app pools - this didn't help
- I then made sure I could access the Umbraco web service on both servers:
- http://serverip1/umbraco/webservices/CacheRefresher.asmx - worked
- http://serverip2/umbraco/webservices/CacheRefresher.asmx - worked
- I disabled distributed calls and then Publish worked, but this wasn't a solution
- Finally the solution was due to incorrect config in \config\umbracoSettings.config. I somehow didn't have the <user>0</user> tag:
<distributedCall enable="true">
<user>0</user>
<servers>
<server>serverip1</server>
<server>serverip2</server>
</servers>
</distributedCall>
These are some of the very useful posts I read, but config was my solution:
Friday, 14 March 2014
How do I copy files after Publish to the Publish folder using Visual Studio 2010 with MSBuild?
My web project in Visual Studio 2010 has post-build events that copies files from a folder into the bin directory of the web project. But when I publish my site, MSBuild seems to ignore the post-build events and these files are NOT copied.
The solution is to create a BAT file that executes from a MSBuild Target. I called my BAT file PostBuildEventPublish.bat and it lives in my solution folder. This is the BAT file contents:
xcopy "%1References\UmbracoCourier.lic" "%2" /y
xcopy "%1References\jumps.umbraco.usync.dll" "%2" /y
The parameters %1 and %2 are input from the MSBuild csproj file. In VS2010 unload your web project and edit the project then insert this Target (at the bottom):
<Target Name="AfterPublish" AfterTargets="CopyAllFilesToSingleFolderForPackage">
<Exec Command="$(SolutionDir)References\PostBuildEventPublish.bat "$(SolutionDir)" "$(ProjectDir)obj\$(Configuration)\Package\PackageTmp\bin"" />
<Message Importance="Normal" Text="Finished PostBuildEventPublish.bat" />
</Target>
Obviously change to the paths you want to use.
As you can see parameter %1 = $(SolutionDir)
and parameter %2 = $(ProjectDir)obj\$(Configuration)\Package\PackageTmp\bin
You will notice that my Target always gets executed before the actual publish files are copied.
C:\Dev\Puma\Main\References\PostBuildEventPublish.bat "C:\Dev\Main\" "C:\Dev\Puma\Main\Web\obj\Debug\Package\PackageTmp\bin"
C:\Dev\Puma\Main\References\UmbracoCourier.lic
1 File(s) copied
C:\Dev\Puma\Main\References\jumps.umbraco.usync.dll
1 File(s) copied
Finished PostBuildEventPublish.bat
Publish Pipeline Deploy phase Pre-Deploy CopyAllFilesToOneFolder Stage
Deleting existing files...
Publishing folder /...
Publishing folder App_Browsers...
Publishing folder App_Data...
Publishing folder App_Data/packages...
Publishing folder App_Data/packages/created...
Publishing folder App_Data/packages/installed...
...
Publishing folder uSync/Template/ZMag...
Publishing folder Views...
========== Build: 5 succeeded or up-to-date, 0 failed, 0 skipped ==========
========== Publish: 1 succeeded, 0 failed, 0 skipped ==========
So parameter %2 is where the magic happens. Here we copy the files into the temp publish folder and when Publish completes copying the files to the actual Publish folder these post-build files will also be copied.
The solution is to create a BAT file that executes from a MSBuild Target. I called my BAT file PostBuildEventPublish.bat and it lives in my solution folder. This is the BAT file contents:
xcopy "%1References\UmbracoCourier.lic" "%2" /y
xcopy "%1References\jumps.umbraco.usync.dll" "%2" /y
The parameters %1 and %2 are input from the MSBuild csproj file. In VS2010 unload your web project and edit the project then insert this Target (at the bottom):
<Target Name="AfterPublish" AfterTargets="CopyAllFilesToSingleFolderForPackage">
<Exec Command="$(SolutionDir)References\PostBuildEventPublish.bat "$(SolutionDir)" "$(ProjectDir)obj\$(Configuration)\Package\PackageTmp\bin"" />
<Message Importance="Normal" Text="Finished PostBuildEventPublish.bat" />
</Target>
Obviously change to the paths you want to use.
As you can see parameter %1 = $(SolutionDir)
and parameter %2 = $(ProjectDir)obj\$(Configuration)\Package\PackageTmp\bin
You will notice that my Target always gets executed before the actual publish files are copied.
C:\Dev\Puma\Main\References\PostBuildEventPublish.bat "C:\Dev\Main\" "C:\Dev\Puma\Main\Web\obj\Debug\Package\PackageTmp\bin"
C:\Dev\Puma\Main\References\UmbracoCourier.lic
1 File(s) copied
C:\Dev\Puma\Main\References\jumps.umbraco.usync.dll
1 File(s) copied
Finished PostBuildEventPublish.bat
Publish Pipeline Deploy phase Pre-Deploy CopyAllFilesToOneFolder Stage
Deleting existing files...
Publishing folder /...
Publishing folder App_Browsers...
Publishing folder App_Data...
Publishing folder App_Data/packages...
Publishing folder App_Data/packages/created...
Publishing folder App_Data/packages/installed...
...
Publishing folder uSync/Template/ZMag...
Publishing folder Views...
========== Build: 5 succeeded or up-to-date, 0 failed, 0 skipped ==========
========== Publish: 1 succeeded, 0 failed, 0 skipped ==========
So parameter %2 is where the magic happens. Here we copy the files into the temp publish folder and when Publish completes copying the files to the actual Publish folder these post-build files will also be copied.
Labels:
AfterPublish,
build,
copy,
CopyAllFilesToSingleFolderForPackage,
csproj,
Events,
exec,
MSBuild,
post,
post-build,
Publish,
target,
visual studio 2010
Subscribe to:
Posts (Atom)