I am trying to use an ASPX page to publish my master database to the web database.
The page contains this code:
PublishManager.Republish(Sitecore.Client.ContentDatabase, new Database[] { web }, LanguageManager.GetLanguages(master).ToArray(), Sitecore.Context.Language);
At compile time, an error is thrown saying:
Compiler Error Message: CS0434: The namespace 'Sitecore.Client' in '...\Sitecore.Client.LicenseOptions.DLL' conflicts with the type 'Sitecore.Client' in '...\Sitecore.Kernel.DLL'
And later in the error, there is:
Publish.aspx(27,56): error CS0234: The type or namespace name 'ContentDatabase' does not exist in the namespace 'Sitecore.Client' (are you missing an assembly reference?)
I know that the Sitecore.Kernel assembly contains the property used in the code above:
namespace Sitecore
{
public static Database ContentDatabase
{
get
{
...
}
}
}
I have looked online and tried a few things that did not help:
- Add the Sitecore.Kernel assembly in a web.config file. Maybe I did not add it the correct way. I do not know.
Change the above code to specifically tell the compiler I want the "Client" static class reference with:
var sitecoreClient = Sitecore.Client; PublishManager.Republish(sitecoreClient.ContentDatabase, new Database[] { web }, LanguageManager.GetLanguages(master).ToArray(), Sitecore.Context.Language);
Add a namespace reference to "Sitecore"
<%@ Import Namespace="Sitecore" %>
I am out of ideas and I do not understand how to resolve this error. I am reaching for your help. How would you solve this conflict?
Thanks
PublishManager.Republish(master, new Database[] { web }, LanguageManager.GetLanguages(master).ToArray(), Sitecore.Context.Language);