C# - Microsoft Expression Encoder missing reference, how to add them to project? - c#

I have an application that has an Image Capture feature.
When I try to build it in Visual Studio 2012, I get missing references to Expression Encoder. The image capture facility has been achieved using Microsoft Expression Encoder, and it uses code from it's API. In order to build this application successfully, the PC where I'm trying to build needs some sort of Expression Encoder codec where it will get the references from.
I have tried installing the full application (Microsoft Expression Encoder 4) which is about 25MB, which fixes all the references. We do not want that, due to the application being offered to clients, which means they will have to install another application, the Expression Encoder 4 on top of our application. I'm thinking that there must be a codec of some sort that contains these missing references which is of course smaller than 25MB.
The missing references are the following:
Microsoft.Expression.Encoder.Devices;
Microsoft.Expression.Encoder.Live;
LiveJob
LiveDeviceSource
EncoderDevices
EncoderDeviceType
EncoderDevice
Source Properties
Preview Window
Does anyone have more experience with this and knows how to fix the missing references?
Thank you very much.

Here's an article that shows workarounds for missing Microsoft.Expression.Encoder.resources.dll file, I was able to get through all exceptions using it, but got stuck on 'Appliation not licensed. To fix, install and run application.'
Link to article:
http://uprightbassics.blogspot.com/2014/01/how-to-deploy-expression-encoder-4-sdk.html

This is not possible to deploy an application that uses EE4 SDK without installing the entire application on the target machine. Things had to change from EE3 to EE4 but it does not. Even if you try to "copy local" DLLs in your application location, it requires to install the 25MB EE4 application.
Hope this helps.

Add reference to
microsoft.expression.encoder.dll
Check in C:\Program Files (x86)\Microsoft SDKs\Expression\Encorder 4
If possible copy the dll into your project and change the property Copy To Output to Copy Always.

Related

Accessing Published Version Number In .Net6 Windows Forms App [duplicate]

I have a windows forms application that is deployed to two different locations.
Intranet - ClickOnce
Internet - Installed on a citrix farm through Windows installer
I display ClickOnce version number for click-once deployed versionApplicationDeployment.IsNetworkDeployed.
if (ApplicationDeployment.IsNetworkDeployed)
return ApplicationDeployment.CurrentDeployment.CurrentVersion;
But for the non-click application, I am not sure how to retrieve clickonce version unless I hardcode the version number in assembly info.
Is there an automatic way of retrieve ClickOnce version number for non-clickonce deployed version?
Add an assembly reference to System.Deployment to your project.
Import the namespace in your class file:
VB.NET:
Imports System.Deployment.Application
C#:
using System.Deployment.Application;
Retrieve the ClickOnce version from the CurrentVersion property.
You can obtain the current version from the ApplicationDeployment.CurrentDeployment.CurrentVersion property. This returns a System.Version object.
Note (from MSDN):
CurrentVersion will differ from UpdatedVersion if a new update has
been installed but you have not yet called Restart. If the deployment
manifest is configured to perform automatic updates, you can compare
these two values to determine if you should restart the application.
NOTE: The CurrentDeployment static property is only valid when the application has been deployed with ClickOnce. Therefore before you access this property, you should check the ApplicationDeployment.IsNetworkDeployed property first. It will always return a false in the debug environment.
VB.NET:
Dim myVersion as Version
If ApplicationDeployment.IsNetworkDeployed Then
myVersion = ApplicationDeployment.CurrentDeployment.CurrentVersion
End If
C#:
Version myVersion;
if (ApplicationDeployment.IsNetworkDeployed)
myVersion = ApplicationDeployment.CurrentDeployment.CurrentVersion;
Use the Version object:
From here on you can use the version information in a label, say on an "About" form, in this way:
VB.NET:
versionLabel.Text = String.Concat("ClickOnce published Version: v", myVersion)
C#:
versionLabel.Text = string.Concat("ClickOnce published Version: v", myVersion);
(Version objects are formatted as a four-part number (major.minor.build.revision).)
No I do not believe that there is a way. I believe the ClickOnce information comes from the manifest which will only be available in a ClickOnce deployment. I think that hard coding the version number is your best option.
I would simply make the assembly version of the main assembly the same as the CLickOnce version every time you put out a new version. Then when it runs as a non-clickonce application, just use Reflection to pick up the assembly version.
Try thread verification:
if (ApplicationDeployment.IsNetworkDeployed)
{
if (ApplicationDeployment.CurrentDeployment.CurrentVersion != ApplicationDeployment.CurrentDeployment.UpdatedVersion)
{
Application.ExitThread();
Application.Restart();
}
}
not that it matters three years later, but I ended up just parsing the manifest file with xml reader.
To expand on RobinDotNet's solution:
Protip: You can automatically run a program or script to do this for you from inside the .csproj file MSBuild configuration every time you build. I did this for one Web application that I am currently maintaining, executing a Cygwin bash shell script to do some version control h4x to calculate a version number from Git history, then pre-process the assembly information source file compiled into the build output.
A similar thing could be done to parse the ClickOnce version number out of the project file i.e., Project.PropertyGroup.ApplicationRevision and Project.PropertyGroup.ApplicationVersion (albeit I don't know what the version string means, but you can just guess until it breaks and fix it then) and insert that version information into the assembly information.
I don't know when the ClickOnce version is bumped, but probably after the build process so you may need to tinker with this solution to get the new number compiled in. I guess there's always /*h4x*/ +1.
I used Cygwin because *nix scripting is so much better than Windows and interpreted code saves you the trouble of building your pre-build program before building, but you could write the program using whatever technology you wanted (including C#/.NET). The command line for the pre-processor goes inside the PreBuildEvent:
<PropertyGroup>
<PreBuildEvent>
$(CYGWIN_ROOT)bin\bash.exe --login -c refresh-version
</PreBuildEvent>
</PropertyGroup>
As you'd imagine, this happens before the build stage so you can effectively pre-process your source code just before compiling it. I didn't want to be automatically editing the Properties\AssemblyInfo.cs file so to play it safe what I did was create a Properties\VersionInfo.base.cs file that contained a text template of a class with version information and was marked as BuildAction=None in the project settings so that it wasn't compiled with the project:
using System.Reflection;
using EngiCan.Common.Properties;
[assembly: AssemblyVersion("0.$REVNUM_DIV(100)$.$REVNUM_MOD(100)$.$DIRTY$")]
[assembly: AssemblyRevisionIdentifier("$REVID$")]
(A very dirty, poor-man's placeholder syntax resembling Windows' environment variables with some additional h4x thrown in was used for simplicity's/complexity's sake)
AssemblyRevisionIdentifierAttribute was a custom attribute that I created to hold the Git SHA1 since it is much more meaningful to developers than a.b.c.d.
My refresh-version program would then copy that file to Properties\VersionInfo.cs, and then do the substitution of the version information that it already calculated/parsed (I used sed(1) for the substitution, which was another benefit to using Cygwin). Properties\VersionInfo.cs was compiled into the program. That file can start out empty and you should ignore it by your version control system because it is automatically changing and the information to generate it is already stored elsewhere.
Hard code, or... Keep track on your versions (File, Assembly, Deploy) in a database. Make a call to the database with your Assembly and get the Deploy version.
This assumes that you are incrementing your versions in a logical way such that each version type has a relationship. It's a lot of work for such a minor problem. I'd personally go with Jared's solution; although I hate hard coding anything.
Using a build component, you could read the click-once version from the project file and write it automatically to the assembly info so both of them are in sync.
Solution for .NET (Core) 7 and higher
On .net Core, you can read the version number from the environment variable ClickOnce_CurrentVersion.
string versionString = Environment.GetEnvironmentVariable("ClickOnce_CurrentVersion") ?? "0.0.0.0";
Version version= Version.Parse(versionString);
MessageBox.Show(version.ToString());
See documentation

Error using haarcascade_profileface.xml

I am writing a program in C# using Visual Studio Express 2013 for Windows Desktop. I want to detect faces that are in profile, so just one eye is visible. I am using haarcascade_profileface.xml for the detection. Every time I try to debug my code I receive this error message:
Error of type "Emgu.CV.Util.CvException" has occurred in Emgu.CV.dll. Additional Information: OpenCV: The node does not represent a user
object (unknown type?)
I use the same code that I use with haarcascade_frontalface_default.xml and with this xml it works.
I really need help. Please help me.
Thanks, B
emgu, using opencv's deprecated c-api, can only read cascade files in the old format (build with opencv_haartraining). you cannot use that cascade file with emgu. blame their devs for living under a rock.
Use the haarcascade files from here instead: https://github.com/Itseez/opencv/tree/master/data/haarcascades_cuda
As berak said, yours are in the wrong format
Emgu using libs from OpenCV, so you need add this libs into your project. The visual studio canĀ“t add as reference the native OpneCV libs, so you can include the libs on root project and set to build always copy to folder 'bin'.
Set project to buld for 64bit processor

.NET Micro framework Compile and Deploy without VisualStudio

Firstly, thank you for bothering to look at my question as 5 days of Googling has left me dreary to say the least.
I would like to know of a way that I can compile and then deploy without the use of Visual Studio. I am able to compile and then use MetaDataProcessor.exe to generate my PE (Portable Executable) files with the -minimize option. However, this seems to be where I get a little stuck. I believe that I am supposed to generate a database file including all of the PE files referenced in my application, and from there I am supposed to convert this into a Motorola SRecord file, however when I take these steps I am getting this result:
1) My .hex file is somewhere around 3.5x larger than the .hex file I pull off of my board after using Visual Studio to deploy (65kb from VS and 305kb with my steps)
2) When attempting to deploy and run my .NETMF application, I receive an error from the board itself saying that at least one of my assemblies has a null checksum (it aborts after the first null checksum received)
What is the secret step that I am missing, or what step am I using incorrectly here? Any help here would be greatly appreciated.
Thank you,
James.

Running TextTransform.exe (T4) on a build server

I am trying to setup a process where my T4 templates will be transformed on the build server (Visual Studio is not installed there).
I've read all online references, but could not get a clear source that shows how to do this.
Specifically, here's the 2 issues i've encountered:
TextTransform.exe throws an error about missing DLL:
C:\TeamCity\buildAgent\work\AppSettings.tt(0,0) : error CS0006:
Compiling transformation: Metadata file
'Microsoft.VisualStudio.TextTemplating.Interfaces.10.0,
Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
could not be found
Registering the DLL files using gacutil fixes this issue, although i would like to avoid this step.
Using the Host.ResolvePath(string) method does not return any value when being run outside of Visual Studio.
This method helps in determining a full path to the .txt file that is used by the template as its data source. Without it this file can not be found on the build server.
Any help will be appreciated in getting this running.
EDIT: opened an MS CONNECT issue: https://connect.microsoft.com/VisualStudio/feedback/details/744137/texttransform-exe-does-not-work-without-vs2010-installed
References i have checked:
Get Visual Studio to run a T4 Template on every build
T4 without Visual Studio?
http://msdn.microsoft.com/en-us/library/ee847423.aspx#buildserver
I believe the issue is that you are using host specific features such ResolvePath.
One way I would try is making sure the templates doesn't use ResolvePath but instead rely on relative paths from a well-known location.
This well-known location could be known by:
1. Convention
2. Environment variable
3. Registry
4. SQL Server
5. Web Service
6. And others
If you don't like the idea of forcing devs setup environment variables I would consider making a "smart" resolvepath that uses the environment variable if available, otherwise relies on Host.ResolvePath.
Hope this helps
Ditch the Microsoft TextTransform.exe and use the free one that ships with MonoDevelop that doesn't have external dependencies.
See here: T4 without Visual Studio?
Copy the following directory from your development machine to the build server.
Source (your machine):
%CommonProgramFiles(x86)%\Microsoft Shared\TextTemplating\<version>.0
Destination (build server):
%CommonProgramFiles(x86)%\Microsoft Shared\TextTemplating\<version>.0
Where <version> is the most recent version.
Copy all assemblies (.dll) from your development machine to the build server.
Source (your machine):
%WinDir%\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.TextTemplating.*
Destination (build server):
%CommonProgramFiles(x86)%\Microsoft Shared\TextTemplating\<version>.0
Where * is the rest of the directory name.
Using Gacutil /i install all copied assemblies into GAC of the build server.

EmguCV 64-bit build runtime error

I am running into issues building an existing 32-bit EmguCV (Version 2.3) into 64-bit using .net 4.0 and VS2010 on a W7/x64 OS. I have purchased a commercial license, if that matters and downloaded from the links provided in the receipt.
The error is
System.TypeInitializationException was unhandled
Message=The type initializer for 'Emgu.CV.CvInvoke' threw an exception.
Source=Emgu.CV
TypeName=Emgu.CV.CvInvoke
I followed the instructions provided in this article. In fact I used the samples projects in the article and they build fine with V2.2, but when I replace with V2.3 binaries (both emgu and opencv), run into the error.
Has anyone successfully built an Emgu (Version 2.3.x) x64 project? Please provide some guidance.
The cause of this error (should anyone else run into the same problem) is that the program cannot access opencv_imgproc231.dll or opencv_core231.dll even though they are present in the output "bin" directory.
There are two solutions:
Add them to the project and set their properties to copy always as they are EMGU's two key files.
If step 1 doesn't work, replace the current key files in the bin folder with new copies.
If both methods fail then there may be a problem with the build, so download a new copy of EMGU from Sourceforge and try again. The error will later be incorporated within an technical article in order to provide a clearer explanation of how to solve it.
Cheers,
Chris
No need to add them to the project; VS will not let you. Simply open FaceRecognizer.cs
at public static partial class CvInvoke and change:
[DllImport(CvInvoke.EXTERN_LIBRARY, CallingConvention = CvInvoke.CvCallingConvention)]
to:
[DllImport(Emgu.CV.CvInvoke.EXTERN_LIBRARY, CallingConvention = Emgu.CV.CvInvoke.CvCallingConvention)]
Ensure you change all of them.
First test this way: open a sample project from emgu cv installaiton directory and run it. for example, open hello world example and try to run it. if sample projects run with out problem then the installation is correct.
For emgu cv sample projects, value of Output Path option in Build settings of the project is set to '..\..\
bin'. To fix your project problem, open the project in visual studio and set value of Output Path option to 'C:\Emgu\emgucv 2.9\bin'. Try to run the project. It must run with success.
Now, set back the value of Output Path option to bin\Debug\. Then, add all DLL files in the 'C:\Emgu\emgucv 2.9\bin' folder to your project using ADD -> Existing Item menu. similarly, add all DLL files in the 'C:\Emgu\emgucv 2.9\bin\x64' folder to your project using ADD -> Existing Item menu. Now, go to properties window and set Copy to Output Directory option of all dll files to Copy Always. Finally, in the Configuration Manager window, create a new configuration for x64 platform.
Good Luck

Categories

Resources