Delphi dcc32 and manifest compilation - manifest

How to compile a Delphi project using DCC32.EXE with the default manifest file?
I've compiled some project and the Task Dialog doesn't appear because of missing the manifest file.
When I compile from the IDE everything works fine but when I use the DCC32.EXE the Task Dialog component doesn't work.
I think the problem in the version info file.

Create a file and name it anything.xml
Write the following into the file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity type="win32" name="App" version="3.1.0.0" processorArchitecture="*"/>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" publicKeyToken="6595b64144ccf1df" language="*" processorArchitecture="*"/>
</dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!--The ID below indicates application support for Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<!--The ID below indicates application support for Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
</application>
</compatibility>
</assembly>
Create a resource file such as proj_manifest.rc and write the following line into it:
1 24 "anything.xml"
Compile the resource file using brcc32.exe
Add the following line to the project source:
{$R 'proj_manifest.res'}
Compile the project using the dcc32.exe and thats all.

Related

How to set NuGet environment variable NUGET_CERT_REVOCATION_MODE` to false on appcenter.ms

I am working on Xamarin.Forms app that is using a private NuGet feed.
For iOS building, I use appcenter.ms that is recommended by Microsoft. I have set up the NuGet restore step via API key by adding Nuget.config next to .sln file.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="DevOps" value="https://xxx.pkgs.visualstudio.com/_packaging/xxx/nuget/v3/index.json" />
</packageSources>
<apikeys>
<add key="https://xxx.pkgs.visualstudio.com/_packaging/xxx/nuget/v3/index.json" value="%encrypted_api_key%" />
</apikeys>
</configuration>
However, nuget restore on appcenter.ms takes so long that build times-out after 30 minutes.
I suspect that issue is the Revocation check mode
I would need to set the NUGET_CERT_REVOCATION_MODE to false.
How to set NuGet environment variable NUGET_CERT_REVOCATION_MODE to false on appcenter.ms? or disable it some other way?

How do I include appsettings.json configuration settings in a nuget package?

I am running .net core 1.1, nuget 3.5, and hosting packages on VS team services.
I looked into transformations here: https://learn.microsoft.com/en-us/nuget/create-packages/source-and-config-file-transformations,
But I need a solution for json files, not config files.
I read that you can use an install.ps1 script to include the file, but I also read that install.ps1 is deprecated.
What is the current method for including json configuration files in a nuget package?
Try to use <files> node in the .nuspec file. Example from here:
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<!-- ... -->
</metadata>
<files>
<!-- Add a readme -->
<file src="readme.txt" target="" />
<!-- Add files from an arbitrary folder that's not necessarily in the project -->
<file src="..\..\SomeRoot\**\*.*" target="" />
</files>
</package>

Could not load file or assembly System.Net.Http.Primitives. Located assembly's manifest definition does not match the assembly reference

I'm working on a program that uses the Google API. However every time I run my program, it I keeps getting the following error:
Could not load file or assembly 'System.Net.Http.Primitives, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f711d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.
I'm using Visual Studio 2012 express. I've tried following this link and looked through many forums, but none seem to work. The main problem seems to come from the DLL file "Google.Apis.dll" which I referenced, and it references System.Net.Http.Primitives v1.5.0.0. However the version my program references is 2.2.13.0. I've tried having the program reference v1.5.0.0 instead (I manage to find the dll along with the source code of Google.Apis) however this only caused another problem in which I needed a more recent version of System.Net.Http.Primitives.
I'm been trying find a way to work around this, however I can't seem to find anything that works. Thank you for time.
I ran into the same issue with the Google API's. The main issue here is if you install the Microsoft Http Client Libraries it puts in your project an updated version of the System.Net.Http.Primitives DLL. The web.config assumes you are still using the default version of 1.5. There are two things that need to happen to fix it:
First: Update to the latest versions of Google API and Microsoft Http Client Libraries. You can install the updates via NuGet. Right click on your website, click "Manage NuGet Packages", select Updates on the left. At the time of this post some of the Google API's are prerelease only. You can install them via NuGet by selecting "include prerelease" on the top left of the update screen.
Second Update/add a dependentAssembly into your web.config. To do this you need to know the version of the System.Net.HTTP.Primitives.dll that was installed. Look in your bin directory within Windows Explorer. Find System.Net.HTTP.Primitives.dll, right click on it, select properties, and click the "Details" tab. Note the version located there. At the time of this post mine was 4.0.10.0.
Then add/update a dependentAssembly section for the correct version.
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
What worked for me was to simply install the "Microsoft Http Client Libraries" from Nuget.
Add following to your web.config (app.config):
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.2.13.0" newVersion="4.2.13.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
For me it worked the following:
On Visual Studio (2012) > Tools > Nuget Package Manager > Package Manager Console.
On top of package Manager Console I have
Package Source: nuget.org
Default project: the project that requires the System.Net.Http.Primitives
Watching inside the project file (yourproject.csproj) with an editor I read which version is needed (in my case was Microsoft.Net.Http.2.2.28)
So I went to https://www.nuget.org/packages/Microsoft.Net.Http/ and I clicked on my version under "Version History" (scroll a bit the page if you don't see it).
After choosing the version you copy the suggested command - in my case it was:
Install-Package Microsoft.Net.Http -Version 2.2.28
but if you need the latest version is just this:
Install-Package Microsoft.Net.Http
and you paste it on your Visual Studio Package Manager Console previously opened as I described before. Execute the command.
In the project under the references, System.Net.Http.Primitives is now updated.
I've had a similar problem.
Try to update nuget (tools/extensions and updates...)
Solved that and some other problems for me.
/Jonas
We were having the similar problem.
But in my case, the solution of modifying the app.config by Paul didn't work.
The reason is I am using it as a plugin inside another application. So it considers that application's configuration file.
So we got the Google api code from GitHub and built the Google.Apis.Core library after removing the dependency of System.Net.Http.Primitives. Then we used that dll which solved our issue.
I ran into this problem when I released my code that uses Google.Apis.Drive.v2 (v1.9.2.1860) to the company I work for. I gave them the exe and all of the DLLs that Visual Studio (and NuGet) generated, and they got the error. I never got the error.
The fix was easy (once I figured it out): When installing the api from Nuget the file 'assemblyname.exe.config' is automatically generated in the output (aka, Debug or Release) folder. All you have to do is include that file when you are running the assembly somewhere other than the folder it was generated. Here's the code for that file for me:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.29.0" newVersion="4.2.29.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
This is basically Paul's "second" fix but it's automatically generated by the package manager. The issue for me was when I tried his "first" fix by updating to Google.Apis.Auth and Google.Apis.Core (v1.9.3) it made things worse. I'd get the same error except now it was for "Google.Apis.Core" was the wrong version (although that probably could have been solved as well by including the same .exe.config file.)
Hope this helps someone, I know this thread is pretty old, but it's the one that a quick Google search led me to.
Edit: Forgot to mention, this is relevant to a console application targeting .NET 4.5. Some of it is probably still relevant to other .NET targets or ASP.NET but I don't know for sure. Your mileage may vary.
The above answer about assemblybinding are correct, but you should NOT touch the machine.config.
The assemblybinding must be set in the config file of all of the EXECUTABLE assemblies of your project (.exe.config) who reference your library, and not in the library assemblies (.dll.config)
NuGet made the following change in Web.Config
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.22.0" newVersion="4.2.22.0" />
</dependentAssembly>
to
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.28.0" newVersion="4.2.28.0" />
</dependentAssembly>
This was following install and subsequent removal (by version control revert) of this package https://www.nuget.org/packages/Microsoft.AspNet.WebApi.MessageHandlers.Compression/
Somehow the popular answer by Paul Lemke was not working for me.
The project is a webforms application that started with .net v 2.0 and has been upgraded to .net version 4.5
I updated the packages and nuget created the correct dependentAssembly/bindingRedirects.
As per some of the comments, it probably is not the best idea to change your local machine.config file.
Apprently I had an attribute in my web.config file that was causing the app to ignore the bindingRedirects.
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
I removed that xmlns attribute and it started working.
Was able to resolve this pretty easily. Just opened up the Nuget Package Manager and updated the Microsoft ASP.NET Web API 2.2 Client Library package. This updated Microsoft.Net.Http to the newest version which resolved the issue with the System.Net.Http.Primitives Assembly from being able to be located. Hope this helps!
In my case I was referencing the NuGet packages from a class library. NuGet fails to inform us that the class library's app.config is completely ignored and we have to manually copy its contents to the .exe's app.config.
I had a similar issue with PowerShell scripts for TFS 2017. The scripts called .NET code to perform custom actions during build processes. I kept getting errors about dll version conflicts.
I was unable to resolve the issue until I implemented a hook into the AppDomain AssemblyResolve event as per this answer: Making binding redirects work for office add-ins
This solution forced the process to use dlls from the current path. I know this is somewhat of a hack, but I had read that when running PowerShell, you cannot always use binding redirects, which is what I originally though I could try: https://github.com/google/google-api-dotnet-client/issues/555
Install-Package Microsoft.Net.Http -Version 2.2.22
This version has that dll \packages\Microsoft.Net.Http.2.2.22\lib\net45\System.Net.Http.Extensions.dll
In my case, Nuget automatic add following to web.config
<runtime xmlns="">
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.9.0" newVersion="2.6.9.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.9.0" newVersion="2.6.9.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.22.0" newVersion="2.2.22.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.10.0" newVersion="2.1.10.0" />
</dependentAssembly>
</assemblyBinding>
But I still got the above error Message, finally I figure it out. You have to copy those tags to the machine.config file located at C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config.
To find the tag of "runtime" on machine.config, replace or add(if there is no such tag) it with your tags from your web.config (the ones I listed just above).

Programmatically configure an EntLib CAB CacheManager

Currently I'm having to include a significant chunk of XML in the app.config to get the CAB CacheManager going and I'd rather hide the configuration away in my code.
Is there any way to programmatically configure an Enterprise Library Caching Application Block's CacheManager?
why don't you use configSource attribute in your web.config to move to another config file the CAB configuration?
For Example:
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="cachingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Caching.Configuration.CacheManagerSettings, Microsoft.Practices.EnterpriseLibrary.Caching, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
....
</configSections>
<cachingConfiguration configSource="Config\Caching.config" />
And then, in Config\Caching.config:
<?xml version="1.0" encoding="utf-8" ?>
<cachingConfiguration defaultCacheManager="DefaultCacheManager">
<cacheManagers>
<add name="DefaultCacheManager"
expirationPollFrequencyInSeconds="60"
maximumElementsInCacheBeforeScavenging="1000"
numberToRemoveWhenScavenging="10"
backingStoreName="Null Storage"
type="Microsoft.Practices.EnterpriseLibrary.Caching.CacheManager, Microsoft.Practices.EnterpriseLibrary.Caching, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
..
As far as I know, you can use a separate config file for each configSection in your web.config
s.

Getting a Reflector error Assembly Not Found when installing CruiseControl.NET

I see an entry in ccnet.exe.config
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="NetReflector" publicKeyToken="2f4dd8b32acbcd8e" culture="neutral" />
<bindingRedirect oldVersion="1.0.0.120" newVersion="1.1.2009.1004" />
</dependentAssembly>
</assemblyBinding>
When I first installed the service, I had no errors, but after following this tutorial
link text
I am getting this error when I try to run the service or CCValidator.
Could not load file or assembly 'NetReflector, Version=1.1.2009.1004, Culture=neutral, PublicKeyToken=dbcd6104b72f39b2' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Can anyone point me in the right direction?
Thanks,
~ck in San Diego
There was issue with cc.net 1.4.4 and the vsts plugin where I had to compile the plugin from source against the netreflector version 1.1.
However this issue has been fixed. Just install the latest version of cc.net, 1.4.4.83 (i.e. 1.4.4 SP1) and use the ccnet.vsts.plugin.dll 1.3.1.
I would use backup the ccnet.config and then just unzip on top
Get the binary zip distribution