I am trying to learn JsReport using c# and .NET core and visual studio. I have installed the required nuget packages (jsreport.binary and jsreport.Local). I am trying to replicate the code found Here. The problem is that I keep getting the following error.
***Severity Code Description Project File Line Suppression State
Error MSB3021 Unable to copy file "C:\Users\jmodiba\source\repos\js\js\obj\Debug\net6.0\apphost.exe" to "bin\Debug\net6.0\js.exe". Access to the path 'bin\Debug\net6.0\js.exe' is denied. js C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets 5097***
here is the code,
using jsreport.Binary;
using jsreport.Local;
using jsreport.Types;
var rs = new LocalReporting().UseBinary(JsReportBinary.GetBinary()).AsUtility().Create();
await rs.RenderAsync(new RenderRequest()
{
Template = new Template()
{
Recipe = Recipe.ChromePdf,
Engine = Engine.None,
Content = "Hello from pdf"
}
});
I managed to find the problem. My antivirus kept on moving the .exe file created to quarantine. Once I created an exception in the antivirus setting my code ran correctly.
Related
I'm trying to reference the Microsoft ActiveX Data Objects 6.1 Library (ADODB) using the csc.exe C# compiler but I'm getting the error:
fatal error CS0009: Metadata file 'c:\Program Files\Common Files\system\ado\msado15.dll' could not be opened -- 'An attempt was made to load a program with an incorrect format. '
I have simplified the files to try tracking the problem.
Batch file Compile.bat:
#ECHO OFF
%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\csc.exe -nologo -r:"C:\Program Files\Common Files\system\ado\msado15.dll" Code.cs
PAUSE >NUL
C# file Code.cs:
class Program {
static void Main() {
ADODB.Connection ADODBConnection = new ADODB.Connection();
System.Console.WriteLine((ADODBConnection == null).ToString());
}
}
I have tried copying the dll to the same folder and referencing it but got the same error.
I also have the compilers versions ...\v2.0.50727\csc.exe and ...\v3.5\csc.exe and the libraries versions msado20.tlb, msado21.tlb, msado25.tlb, msado26.tlb, msado27.tlb, msado28.tlb and msado60.tlb.
When I try the same on Visual Studio 2017 (.NET Framework 4 Console Application) it works. It creates ConsoleApp1\ConsoleApp1\obj\Debug\Interop.ADODB.dll and references that instead but I don't know where it gets it from. I have tried searching for it in different folders.
I found the file that Visual Studio uses from this thread (by searching online for Interop.ADODB.dll file location) and later this link:
C:\Program Files\Microsoft.NET\Primary Interop Assemblies\adodb.dll
Working Compile.bat:
#ECHO OFF
%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\csc.exe -nologo -r:"%ProgramFiles%\Microsoft.NET\Primary Interop Assemblies\adodb.dll" Code.cs
PAUSE >NUL
I am attempting to implement a QR Code reader from within HoloLens, working off of Mike Taulty's solution (https://mtaulty.com/2016/12/28/windows-10-uwp-qr-code-scanning-with-zxing-and-hololens/). However, I am having an issue with building out the project in Unity, as I am getting a build error: "Assets\Placeholder.cs(20,9): error CS0103: The name 'MediaFrameQrProcessing' does not exist in the current context", which seems to be implying that the DLLs aren't working properly? A already have a DLL by the same name in my project, and I would assume that this DLL would cover this issue, but it appear to not.
I am running Unity 2018.4.1 and Visual Studio 2019. I am building on top of his GitHub repo (https://github.com/mtaulty/QrCodes).
This is the block that throws the build error. MediaFrameQrProcessing cannot be found
public void OnScan()
{
this.textMesh.text = "scanning for 30s";
#if !UNITY_EDITOR
MediaFrameQrProcessing.Wrappers.ZXingQrCodeScanner.ScanFirstCameraForQrCode(
result =>
{
UnityEngine.WSA.Application.InvokeOnAppThread(() =>
{
this.textMesh.text = result ?? "not found";
},
false);
},
TimeSpan.FromSeconds(30));
#endif
}
Expected: Project Builds w/o incident
Actual Results: Assets\Placeholder.cs(20,9): error CS0103: The name 'MediaFrameQrProcessing' does not exist in the current context build error. This should be covered by the DLL
Screenshots of the import settings:
It is recommended to try to build with unity2017. I built the unity project in repository with unity2017.4.31f1 and it seemed to work fine.
Update:
I used 2018.4.3 to create a new project and did some simple tests, this error was not thrown after using such a Import Setting.
I want to use the OCR component of UWP in an WPF C# app.This is done by using a C# class library in other projects. On build I get the following error shown below. How can I get this to compile?
Error 1 Problem generating manifest. Could not load file or assembly
'{MyAppPath}\Windows.winmd' or one of its dependencies. Attempt to
load a program with an incorrect format.
The picture shows the references:
The files are:
System.Runtime.WindowsRuntime: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETCore\v4.5\System.Runtime.WindowsRuntime.dll
System.Runtime.InteropServices.WindowsRuntime: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.6.1\Facades\System.Runtime.InteropServices.WindowsRuntime.dll
Windows: C:\Program Files (x86)\Windows Kits\10\UnionMetadata\Windows.winmd
The Code I want to use (not in a finsished state, I just want it to compile)
using System;
using Windows.Graphics.Imaging;
using Windows.Media.Ocr;
using Windows.Storage;
namespace tegBase
{
public class Scan
{
public static async void OcrAusfuehren()
{
var fileName = #"C:\a.jpg";
StorageFile file = await StorageFile.GetFileFromPathAsync(fileName);
var stream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read);
var decoder = await Windows.Graphics.Imaging.BitmapDecoder.CreateAsync(stream);
SoftwareBitmap b;
b = await decoder.GetSoftwareBitmapAsync();
OcrEngine ocrEngine = OcrEngine.TryCreateFromUserProfileLanguages();
var s = await ocrEngine.RecognizeAsync(b);
Windows.Media.Ocr.OcrResult c = s;
Console.WriteLine(c.Text);
}
}
}
Update:
I tried to reproduce the error on another PC, there however, the UnionMetadata folder is empty. So I took the winmd from 10.0.16299.0, but it lead to the same result.
I also tried changing the target framework from .net 4.5.1 to 4.6.1, which also did not solve the problem. On a sidenote: changing it to 4.7.1 was not possible, as VS said it was not installed. Installing 4.7.1 was also not possible, with the installer message beeing: Higher Version already installed.
You need to download the UWP software development kit (SDK) and migrate the package to package references. This must be done in order to use all the UWP libraries within a WPF/WinForms/Console application. Please visit this website for a step-by-step tutorial: https://www.thomasclaudiushuber.com/2019/04/26/calling-windows-10-apis-from-your-wpf-application/
I'm trying to run a local SSIS package from a C# console application. I've built both the package and the application using .Net 4.5.1 in VisualStudio 2012. When I say "local" I mean the SSIS package hasn't been deployed to a SQL Server; I'm just trying to call the .dtsx file from the file system. The SSIS package runs fine from within VisualStudio. Here's my code:
string pkgLocation = #"C:\Users\06717\Documents\Visual Studio 2012\Projects\RMA_Data_Cleanup\RMA_Data_Cleanup\";
string pkgName = "Package.dtsx";
Application app = new Application();
Package pkg = new Package();
DTSExecResult pkgResults = new DTSExecResult();
try
{
pkg = app.LoadPackage(pkgLocation + pkgName, null);
There's more after this, obviously, but the problem comes with the app.LoadPackage line. When I try to run it, this exception gets thrown:
The package failed to load due to error 0xC0011008 "Error loading from XML. No further detailed error information can be specified for this problem because no Events object was passed where detailed error information can be stored.". This occurs when CPackage::LoadFromXML fails.
I've googled this error message, and I haven't found anything that seems to apply to my case. One thing that occurs to me is that maybe I'm calling the wrong dtsx file. There's another one in the obj\Development folder. I've tried calling that one too, but I get the same exception. Am I calling the right file? Is there something I need to do from within Visual Studio, other than build the package, before I can do this? (pkgResults = Success, BTW)
I am trying to connect to skydrive with this code, it is console C# application:
var client = new SkyDriveServiceClient();
client.LogOn("username", "password");
and I got this exception: The operation has timed out.
Anyone know what is solution for this problem?
Ok, download the latest version (Changset 68942) from this
location. After download open the project (located in folder trunk/src/SkyDriveServiceClient.sln) in Visual Studio and change the variable SkyDocsServiceUri in the class SkyDocsServiceClient to the following:
public static readonly Uri SkyDocsServiceUri = new Uri("https://docs.live.net/SkyDocsService.svc");
After the change compile the project to build the assembly file. Then you need to reference the assembly from your project and try to execute your code again.