Strong Named satellite assemblies using ResGen & AL with multiple resx / resources files - resources

For whatever reason, when compiling multiple .resources files into a single satellite assembly (.dll) the resources will not show. Compiling a single resource will work. Here are the steps I used...
We have a project called "Report Viewer". This project is signed using a key, MySnKey.snk via Properties > Signing > Sign the assembly , choose a strong name key file: MySnKey.snk.
All forms have been updated to Localizable = True
We processed all the resx files into German de-DE. There are only two resx: MainForm.resx (project root directory) and Resources.resx (Properties directory).
I have a folder with MainForm.de-DE.resx and Resources.de-DE.resx which are the translated versions of these files.
Using resgen,
> "C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\ResGen" /compile Resources.de-DE.resx ReportViewer.Resources.de-DE.resources
> "C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\ResGen" /compile MainForm.de-DE.resx ReportViewer.MainForm.de-DE.resources
This creates the appropriate .resources files. Now to link, I use AL.exe:
> "C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\AL" /t:lib /embed:ReportViewer.MainForm.de-DE.resources,ReportViewer.Resources.de-DE.resources /culture:de-DE /out:ReportViewer.resources.dll /template:../../../Output/ReportViewer/bin/Debug/ReportViewer.exe /keyfile:../MySnKey.snk
This creates a ReportViewer.resources.dll file. If I place it into the appropriate sub folder de-DE>ReportViewer.resources.dll, no luck. In Program.cs, before Run is called, I have
Thread.CurrentThread.CurrentUICulture = new CultureInfo("de-DE");
IF, I only include the MainForm like
> "C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\AL" /t:lib /embed:ReportViewer.MainForm.de-DE.resources /culture:de-DE /out:ReportViewer.resources.dll /template:../../../Output/ReportViewer/bin/Debug/ReportViewer.exe /keyfile:../MySnKey.snk
The appropriate resources are displayed.
This is quite confusing to me. If I add the .resx files to the solution, and compile, the output dll works correctly, but we are trying to avoid having to bring these satellite translations into the solution.
No errors are generated and the files are created so I'm lost as to what I'm not doing.
Any help is greatly appreciated. I compared the differences between the output dll when adding the files to the solution to the output file when running AL.exe and they both contain all the translations.
EDIT to include solution since I can't answer the question
Apparently I got confused with the embed option and it's usage. To properly use the AL.exe utility, I had to use:
> "C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\ResGen" Resources.de-DE.resx ReportViewer.Properties.Resources.de-DE.resources
Notice above that the Properties namespace is added. I had not done that before.
> "C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\ResGen" MainForm.de-DE.resx ReportViewer.MainForm.de-DE.resources
Notice that no Properties namespace is added since MainForm is Simply in the ReportViewer namespace.
> "C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\AL"
/t:lib
/embed:ReportViewer.Properties.Resources.de-DE.resources
/embed:ReportViewer.MainForm.de-DE.resources
/culture:de-DE /out:ReportViewer.resources.dll /template:../../../Output/ReportViewer/bin/Debug/ReportViewer.exe /keyfile:../MySnKey.snk
Notice that there are multiple /embed items in this line. I was using the comma, which renames the internals and is not what I wanted. Providing a space between the files gives a (seemingly) unrelated error. See http://ondotnet.com/pub/a/dotnet/2002/10/14/local2.htm?page=2 for a great article.
For completeness, another way of writing this script would be
> "C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\ResGen" Resources.de-DE.resx
notice that no renaming is done here, the output is simply Resources.de-DE.resources
> "C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\ResGen" MainForm.de-DE.resx
notice that no renaming is done here, the output is simply MainForm.de-DE.resources
> "C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\AL" /t:lib
/embed:Resources.de-DE.resources,ReportViewer.Properties.Resources.de-DE.resources
/embed:MainForm.de-DE.resources,ReportViewer.MainForm.de-DE.resources
/culture:de-DE
/out:ReportViewer.resources.dll /template:../../../Output/ReportViewer/bin/Debug/ReportViewer.exe /keyfile:../MySnKey.snk
Notice that the renaming is done following the comma in the embed option. The first argument is the file name (the .resources file) and after the comma is the fully qualified name (namespace.class.xx-XX.resources).

Answered in the post before I knew I could answer it here.

Related

Robocopy fail to create directories on local hard drive Error 1 Incorrect Function

I'm having an issue with robocopy in which every call to create a new directory on the destination fails. I get outputs such as:
2019/03/19 16:59:11 ERROR 1 (0x00000001) Creating Destination Directory T:\tmp\MIDCAS_SSP\Documents\Customer Reviews\MASPS 1 review\Received Comments\
The copy operation I am attempting is from a sharepoint list mapped to drive X: onto a subdirectory of a physical hard drive T:
OS Name Microsoft Windows 10 Home,
Version 10.0.17134 Build 17134
I have tried several variants, run command as both user and admin. Below is the commands and printout of one of many attempts.
PS T:\tmp\MIDCAS_SSP> .\Sync_XNet.bat
T:\tmp\MIDCAS_SSP>SET Target=T:\tmp\MIDCAS_SSP\Documents
T:\tmp\MIDCAS_SSP>ECHO T:\tmp\MIDCAS_SSP\Documents
T:\tmp\MIDCAS_SSP\Documents
T:\tmp\MIDCAS_SSP>Set XNetSource=X:
T:\tmp\MIDCAS_SSP>net use X: "\\site.name.domain#SSL\DavWWWRoot\sites\MidcasSSP\Shared Documents"
T:\tmp\MIDCAS_SSP>robocopy /XJ /ZB /MIR /FFT /NDL /TS /R:1 /W:2 "X: " "T:\tmp\MIDCAS_SSP\Documents "
-------------------------------------------------------------------------------
ROBOCOPY :: Robust File Copy for Windows :: Version XP010
-------------------------------------------------------------------------------
Started : Tue Mar 19 16:59:11 2019
Source = X:\
Dest : T:\tmp\MIDCAS_SSP\Documents\
Files : *.*
Options : *.* /FFT /TS /NDL /S /E /COPY:DAT /PURGE /MIR /ZB /XJ /R:1 /W:2
------------------------------------------------------------------------------
2019/03/19 16:59:11 ERROR 1 (0x00000001) Creating Destination Directory T:\tmp\MIDCAS_SSP\Documents\Customer Reviews\MASPS 1 review\Received Comments\
Incorrect function.
Waiting 2 seconds... Retrying...
2019/03/19 16:59:13 ERROR 1 (0x00000001) Creating Destination Directory T:\tmp\MIDCAS_SSP\Documents\Customer Reviews\MASPS 1 review\Received Comments\
Incorrect function.
ERROR: RETRY LIMIT EXCEEDED.
I've checked user and admin rights to the disk.
If I manually create the missing directories, any files therein are copied as intended until a new subdirectory is found but that's a lot of work to get through...
The above listing is using Windows 10 robocopy, but also using the Windows Server 2003 Resource Kit version I have the same problem.
I've also attempted to connect using https:// syntax for the net use command. After I post this I'll reboot as a last ditch attempt.
Ideas where I went wrong? Alternative approaches to back up a remote SharePoint sites' files to off-site disk?
I ran into the same problem, and googling brought me here. Ultimately I didn't find why it doesn't work, but a workaround that did the job for me was to copy the directory structure first using xcopy.
Example:
xcopy /t /e "\\intranet.companyname.com\departments\deptname\Procedures\" "z:\backup\"
robocopy.exe "\\intranet.companyname.com\departments\deptname\Procedures\" "z:\backup" /mir /R:0

The type or namespace name "ContentBySearchWebPart" could not be found

Recently, I was trying to add a Content Search Web Part using csom in Visual Studio 2017, While I was adding the "ContentBySearchWebPart" class, an error occured as:
"The type or namespace name "ContentBySearchWebPart" could not be found(you are missing a using directive or an assembly reference?)".
Even I was using the namespace as "Microsoft.Office.Server.Search.WebControls" and also the "Microsoft.SharePoint.Client.Search" dll.
How can I resolve this issue?
You need to add reference "Microsoft.Office.Server.Search.dll" manually from ISAPI folder or GAC
ISAPI folder
<Windows>\Program Files\Common Files\Microsoft Shared\Web Server Extenstions\16\ISAPI
GAC
(C:\windows\Windows.NET\assembly\GAC_MSIL\Microsoft.Office.Server.Search).
Namespace: Microsoft.Office.Server.Search.WebControls
Assembly: Microsoft.Office.Server.Search (in Microsoft.Office.Server.Search.dll)
https://social.msdn.microsoft.com/Forums/sharepoint/en-US/c6f03ea3-f893-4126-88e3-52a2a66b5f18/missing-assembly-reference-for-microsoftofficeserversearch?forum=sharepointdevelopmentprevious
Check your \Program Files\Common Files\Microsoft Shared\Web Server Extenstions\14\ISAPI, you'll find alot more DLL's inside this folder including your Microsoft.Office.Server.Search.dll that you are looking for.

MoveFileEx with MOVEFILE_REPLACE_EXISTING flag Fails with LastError = 183

We have an application that makes a backup of a configuration file by copying it to a sub-folder (see log file entry below) using the following command:-
BOOL b = MoveFileEx(ExistingFileSpec, NewFileSpec, MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH | MOVEFILE_COPY_ALLOWED);
This appears to work as expected on most systems but on two we get the following warning in our log file:-
11 Jun 2018 10:58:05.437 W. COMMON WARNING MoveFile failed on C:\Program Files\Configuration\Stores.xml to C:\Program Files\Configuration\Backup\Stores.xml LastError=183
Lasterror =183 means "ERROR_ALREADY_EXISTS"
This is odd since MOVEFILE_REPLACE_EXISTING is specifically meant to enable this command to work when the target file exists.
This is happening on Win7 x86 machines.
In a previous version of the code MoveFile was used but with a DeleteFile call immediately prior to ensure the target file did not exist. When the code was rolled back to this version it works.
Any suggestions?

"RegisterPlugin" task was not found in CRM 2011

i am trying to deploy the crm project, I am getting following error.
'Error 105 The "RegisterPlugin" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the "C:\Program Files (x86)\MSBuild\12.0\bin" directory. <file path\CRM\Microsoft.CrmDeveloperTools.CrmClient.targets 176 4 <path>.CrmPackage'
I have tried the solution https://community.dynamics.com/crm/b/crmbusiness/archive/2014/01/22/crm-2011-error-registering-plugins-and-or-workflows-the-resource-string-errorserializingregfile-for-the-registerplugin-task-cannot-be-found
but no luck. any other clue?
Thank you
JK
That error means you have a MSBuild step to run "RegisterTask" task but that Task wasn't defined in the tasks file (path\CRM\Microsoft.CrmDeveloperTools.CrmClient.targets) (there should be some sort of which references "RegisterPlugin"), OR, the process can't read from that folder (permissions) or the folder doesn't exists.

Veracode through an error - ASPCONFIG: Could not autodiscover 'components.config'

I have a Veracode plugin in my VS 2013 Professional.
I have ucommerce.dll, Sitecore.Kernel and Sitecore.Analytics.dll
I set copy local true for all above dll files.
When i tried to pre-compile all the web project I'm getting a below error message
1>------ Pre-compile started: Project: XXXXX.Web.PQRPorta\ ------
1>Pre-compiling with command similar to the following:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -p
"C:/XXXXX.Web.PQRPortal" -v "XXXXX.Web.PQRPortal/" -fixednames -f -c
-d "C:/SVN/trunk/Releases/SourceCode/Source/PrecompiledWeb/XXXXX.Web.PQRPortal"
1>error ASPCONFIG: Could not autodiscover 'components.config'. Make
sure it's present in the application folder
'C:\SVN\trunk\Releases\SourceCode\Source\XXXXX.Web.PQRPortal\' or in a
sub folder. Paths ignored
''C:\SVN\trunk\Releases\SourceCode\Source\XXXXX.Web.PQRPortal\bin',
'C:\SVN\trunk\Releases\SourceCode\Source\XXXXX.Web.PQRPortal\App_Data',
'C:\SVN\trunk\Releases\SourceCode\Source\XXXXX.Web.PQRPortal\obj''
1>XXXXX.Web.PQRPortal\ - 1 error, 0 warnings
Is there any configuration missing?
Update
I found the components.config file inside
C:\inetpub\wwwroot\XXXX\Website\sitecore modules\Shell\uCommerce\Configuration
and I added the file inside the web project root directory and tried to precompile web project, now I’m getting different error error
ASPRUNTIME: Type is not resolved for member 'Castle.Windsor.Configuration.Interpreters.ConfigurationProcessingException,Cast‌​le.Windsor, Version=3.2.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc'.
any solution for it?
The components.config is a file uCommerce need.
The configuration file should be placed somewhere below the uCommerce folder. (not sure where depend on the version) It will automatically be picked up when the application starts up.

Resources