I want to validate the username and password before proceeding with the NSIS install.
When I click on the next button, I want to check whether the user is authorized to install the application. For this check, I want to make a WCF call from my .NET application. It will return true or false.
Based on that, I will proceed or abort my installation. I tried using the CLR::Call /NOUNLOAD plugin. Since I am referring to a service reference, it is throwing the exception:
Error calling .net dll method
Here is the NSIS script that I have so far:
Name "Test CLRDLL MakeLogEntry"
OutFile "TestCLRDLL.exe"
Page instfiles
Section
start InitPluginsDir
SetOutPath $PLUGINSDIR
File "MyDll.dll"
CLR::Call /NOUNLOAD "MyDll.dll" "namespace.classname" \ "ValidateLogin" 3 "Myserviceaddress/Servicename.svc"; "username" "password"
pop $0
MessageBox MB_OK $0
sectionEnd
Function .onGUIEnd
CLR::Destroy
FunctionEnd
You should also know, that CLR::Call plugin works only with .Net 2.0 assemblies (not higher).
So maybe you should recompile your dll.
You cannot do this.
The CLR::Call plugin only supports .Net 2.0 assemblies.
WCF was introduced in .NET 3.0.
Related
Using the Microsoft.Extensions.Configuration package, I have the following line in my Program.cs file:
config.AddUserSecrets<Startup>(optional: false);
With a populated secrets.json file present, this line works as presumed. Alternatively, I would assume that a missing secrets.json file should trigger an exception of some sort, since I marked it as required; however, no exception is thrown.
Is this to be expected? My ultimate goal is to give developers an obvious indicator if they pull a project out of source control and attempt to run it without also having created a correlated secrets file.
I'm trying to debug and evaluate expression in my blazor wasm Program.cs using QuickWatch in my Visual Studio 2019. To make the breakpoint hit in Main method, I added
await Task.Delay(10000);
this gives debugging proxy some time to load as mentioned in docs.
Now after my break point gets hit if I select any expression and press Shift+F9 to toggle QuickWatch, I get
Unable to evaluate (Unable to evaluate)
for any variables, expression. Please assist on what I'm missing
Screen Print:
Currently Blazor WebAssembly does not support hitting breakpoint the Program > Main method inside Program.cs. Below is from Microsoft docs:
For now, you can't:
Break on unhandled exceptions.
Hit breakpoints during app startup before the debug proxy is running. This includes breakpoints in
Program.Main (Program.cs) and breakpoints in the
OnInitialized{Async} methods of components that are loaded by the
first page requested from the app.
For me it was an upgrade issue from DotNet Core 3.x to 5.0.
It is a good idea to create a completely new Blazor Application with identical configuration and compare all project files. In my case it was an entry in {MyProject}.Server.csproj of:
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="3.2.1" />
that needed to be updated to the latest version:
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="5.0.4" />
Everything worked fine to run and breakpoints were hit but until I changed that line all variables would show "Unable to evaluate (Unable to evaluate)" in Quickwatch and hovering in the editor showed nothing.
I installed a VS2017, tried to develop a first app in VS2017.
File > New Project > Visual Basic > Windows Desktop > Windows Forms App (.NET Framework)
simply tried to run an app with only one label on form, but build error comes up, I clicked on "Yes" then dialogue box appears (image).
Error Code- BC37225
Error Message- Failure writing debug information: Unable to load DLL <br>'Microsoft.DiaSymReader.Native.amd64.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
Then searched SO, read and tried solutions, but not worked.
What I tried from SO is-
Error while building C# Console Application: Error CS0041 Cannot find a module
(1) installed Microsoft.NETCore.Platforms (nuget package)
(2) installed Microsoft.DiaSymReader.Native.amd64.dll (nuget package)
(3) Unable to load DLL 'Microsoft.DiaSymReader.Native.amd64.dll
in this, solution is available (accepted answer), but I don't know from where to delete these lines of code.
<PropertyGroup>
<Deterministic> true </Deterministic>
</PropertyGroup>
what could be the solution?
When the build errors dialog comes up it asks if you want to run a previous build because the current build will not compile (won't make a new .exe file) Since this is the first run of your program there was no previous build, no .exe. What you need to resolve are the build errors.
I am trying out Blazor and i do not understand why when changing a component after refreshing the browser page it does not update ? Shouldn't the client update itself similar to how angular does?
It only refreshes when i restart the blazor server.
Index.cshtml
#page "/"
<h1>Hello, world!</h1>
If i change lets say the text inside the <h1> to Hello people , i save the project and i refresh the page ( as i am advised in the Blazor tutorial) shouldn't i see Hello people ?
After Asp.net Core 3.0, Runtime compilation is enabled using the Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation package.
To enable runtime compilation, apps must:
Install the Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation NuGet package.
Update the project's Startup.ConfigureServices method to include a call to AddRazorRuntimeCompilation:
services
.AddControllersWithViews()
.AddRazorRuntimeCompilation();
or
services.AddMvc().AddRazorRuntimeCompilation();
I guess you are running the app with the debugger connected? this prevents the recompilation. You need to:
Press Ctrl-F5 to run the app without the debugger. Running with the debugger (F5) isn't supported at this time.
https://github.com/dotnet/aspnetcore/issues/5456
You should add or enable runtime compilation in razor pages,
Install-Package Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation -Version 3.1.6
After installing set the startup file as ,
services.AddMvc().AddRazorRuntimeCompilation();
do the following:
Install the Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation from NuGet.
Update the ConfigureServices method in the Startup class to look like below:
services.AddControllersWithViews().AddRazorRuntimeCompilation();
You good to go.
If you go into Tools > Options > Keyboard and search in the "Show commands containing" search box search for "BrowserLink". Find the option that says "OtherContextMenus.BrowserLink.RefreshLinkedBrowsers" by default this is set to CTRL+Alt+Enter. Click "Remove" and then select the "Press Shortcut Keys" input and press Ctrl+S. Next (just to the left of the input) change Use new shortcut in "Global" to be "Text Editor". Click "Ok" until the window has closed. Now Visual Studio shares CTRL+S with both Saving files and Refreshing linked browsers.
(This will only work if your text editor .cshtml, .css, .js, etc. files in the edit window are the active selections) WARNING: if you don't set it to something other than global then it will override the shortcut for Save and you won't be able to save your files.
Adding "services.AddMvc().AddRazorRuntimeCompilation();" and installing the Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation package 6.0.5 will fix the problem but it will ruin the "css isolation". The first thing you will notice is that the footer will lose its position
I have a .Net Core web application targeting net461 Framework. It was originally producing an .EXE and working fine when deploying to IIS. I want to change to a portable app, so I changed "buildOptions" in ProjectJson as follows:
"buildOptions": {
"emitEntryPoint": false,
"preserveCompilationContext": true,
"debugType": "portable"
},
Now when I compile I get a DLL and it runs fine in IIS Express, but when I publish to IIS and change the web.config aspnetcore element to:
<aspNetCore processPath="dotnet" arguments=".\myWebApp.dll"
stdoutLogEnabled="false"
stdoutLogFile=".\logs\stdout"
forwardWindowsAuthToken="false" />
The project fails to run and I see "Failed to start process with commandline '"dotnet" MyWebApp.dll', ErrorCode = '0x80004005'" in the application event log.
Attempting to run from command line with "dotnet mywebapp.dll" results in:
A fatal error was encountered. The library 'hostpolicy.dll' required to
execute the application was not found in 'C:\inetpub\wwwroot\ETimeCore2'.
So I found and copied hostpolicy.dll to the directory and now get:
Could not resolve CoreCLR path. For more details, enable tracing by setting
CORE HOST_TRACE environment variable to 1
I did set the CORE HOST_TRACE to 1 and got a verbose response of all the dlls being loaded with just that one error (above) at the end so it added no value.
Any idea what I am doing wrong?? I prefer a DLL to an EXE because to publish changes when an .EXE, you have to recycle the app pool first which is a real pain.
You cannot use dotnet mywebapp.dll if disable "emitEntryPoint".
emitEntryPoint indicates whether the project is a console application vs. a library. From sources:
if (framework.IsDesktop() && compilerOptions.EmitEntryPoint.GetValueOrDefault())
{
OutputExtension = FileNameSuffixes.DotNet.Exe;
}
In your case the framework.IsDesktop() is true, as your target framework is net461, that is .NET Framework , not .NET Core. That's way you get .exe as output if enable emitEntryPoint.
Actually error "The library 'hostpolicy.dll' required to execute the application was not found in " right now means the following (see http://github.com/dotnet/cli/issues/2859 issue):
dotnet.exe cannot find the entry point in mywebapp.dll