Using the AjaxControlToolkit.config file from the ASP.NET Ajax Toolscriptmanager page:
<ajaxControlToolkit>
<controlBundles>
<controlBundle>
<control name="AccordionExtender"></control>
<control name="CalendarExtender"></control>
<control name="HtmlEditorExtender"></control>
</controlBundle>
</controlBundles>
</ajaxControlToolkit>
Generates the error message 'AjaxControlToolkit is not declared'. Don't know where or how to declare it.
That is just visual studio letting you know it is not defined but it will not affect the functionality. It will work fine assuming you have your AjaxControlToolkit config file in the root directory with your control bundles defined properly
I have that 'error' too but am able to use control bundles just fine in my toolkitscriptmanager; I just ignore the error
Related
I'm using AsyncAwaitBestPractices.MVVM's IAsyncCommand and AsyncCommand in my Xamarin.Forms app. The UWP version of the app is compiled with .NET Native tool chain. When I do SomeAsyncCommand.RaiseCanExecuteChanged(), I get an exception:
System.Reflection.MissingMetadataException: 'This operation cannot be carried out because metadata for the following object was removed for performance reasons:\n\n EETypeRva:0x000976A0\n\nNo further information is available. Rebuild in debug mode for better information.\n\n'
Note that this was a debug build. When I added a local copy of the library, I was able to find the line that triggers the exception:
static bool IsLightweightMethod(this MethodBase method)
{
var typeInfoRTDynamicMethod = typeof(DynamicMethod).GetTypeInfo().GetDeclaredNestedType("RTDynamicMethod");
return ...
}
The exception is triggered by GetDeclaredNestedType("RTDynamicMethod"). So the binaries do include the metadata of DynamicMethod, but not that of it's child type RTDynamicMethod. They have been removed because of .NET Native tool chain.
Now, I read that you can whitelist classes / namespaces / assemblies in project properties -> Default.rd.xml. But I can't seem to get the right element to whitelist the nested class. Here's what I tried:
<Assembly Name="System.Private.CoreLib" Dynamic="Required All" />
<Namespace Name="System.Reflection.Emit" Dynamic="Required All" />
<Type Name="System.Reflection.Emit.DynamicMethod">
<Type Name="RTDynamicMethod" Dynamic="Required All"/>
</Type>
Here System.Private.CoreLib is the assembly of DynamicMethod, System.Reflection.Emit is the namespace of DynamicMethod and RTDynamicMethod. As far as I understand, either of the three should work, yet none of them do. Edit: the type one gives me a warning: Default.rd.xml(35): warning : ILTransform : warning ILT0027: Type 'System.Reflection.Emit.DynamicMethod' could not be found.
I also tried variations using Type Name="System.Reflection.Emit.DynamicMethod+RTDynamicMethod", using <Library>, with or without namespaces in type, etc.
At first, you can try to use the following code in the Default.rd.xml:
<Type Name="System.Reflection.Emit.DynamicMethod" Dynamic="Required All">
<Type Name="System.Reflection.Emit.RTDynamicMethod" Dynamic="Required All">
For more information, you can check the similar case and the issue on the github.
In addition, why did you add the tag .net 6.0? I have checked the package named System.Reflection.Emit, the last update time is 12/4/2019 and it does't support the .net 6.0.
I've defined a compilation callback for my MVC views like
var mvc = services.AddMvc();
mvc.AddRazorOptions(razorSetup => {
razorSetup.CompilationCallback = context => {
// context.Compilation = context.Compilation.AddReferences(...)
};
});
This works great - and while debugging, there's no problem - but when the build-tools are precompiling the views (and as of asp.net core 2, precompiling is the default behavior), the compilation callback is just not used anymore.
While this makes perfect sense to me (after a bit of struggling), I wan't to know how/where I can configure the precompilation task.
I finally found a solution...
.net core 2
In .net core 2 you can add a --configure-compilation-type=-Option to the respone file used during compilation. The value should be a fully qualified type that implements Microsoft.AspNetCore.Mvc.IDesignTimeMvcBuilderConfiguration (not sure if it's necessarry or if it's sufficient to have a Configure-method here)
Adding can be done via
<Target Name="_AddMvzRazorPrecompileOptions" AfterTargets="_CreateResponseFileForMvcRazorPrecompile">
<Error Condition="!Exists($(_MvcRazorResponseFilePath))" Text="File $(_MvcRazorResponseFilePath) does not exist" />
<ItemGroup>
<_Option Include="--configure-compilation-type=KlugeSoftware.Web.ViewTranslator.PrecompileFactory, KlugeSoftware.Web.ViewTranslator" />
</ItemGroup>
<WriteLinesToFile File="$(_MvcRazorResponseFilePath)" Lines="#(_Option)" Overwrite="false" />
</Target>
.net core 3
Not that easy (at least I didn't find anything so far). But you can use a similar way to get your code between razor generation (creation of *.g.cs - files) and compiling them.
<Target Name="_DoSomethingSpecial" AfterTargets="PrepareForRazorCompile" BeforeTargets="RazorCoreCompile">
<!-- ... -->
</Target>
At this point, you can use a custom msbuild task to inspect or modify the generated code (and/or the source code).
Source files are stored in #(RazorCompile), dependencies in #(RazorReferencePath)....
I have written a .NET 4 desktop application and when trying to run the Setup.exe I am getting the following error in the log file.
I am using Visual Studio 2012 with Wix 3.7.
MSI (s) (E8:1C) [16:51:54:890]: Invoking remote custom action. DLL: C:\windows\Installer\MSIFECD.tmp, Entrypoint: EncryptConfig
SFXCA: Extracting custom action to temporary directory: C:\windows\Installer\MSIFECD.tmp-\
SFXCA: Binding to CLR version v4.0.30319
Calling custom action SecureConfig!SecureConfig.CustomActions.EncryptConfig
EncryptConfig: Begin
An error occurred creating the configuration section handler for security: Could not load file or assembly 'Order.Configuration.Net' or one of its dependencies. The system cannot find the file specified. (C:\Program Files (x86)\Orbit Order System\Orbit Order System.exe.config line 6)
CustomAction EncryptConfigurationFile returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
Action ended 16:51:55: InstallFinalize. Return value 3.
I can confirm that `Order.Configuration.Net.dll' exists in the target folder as does the application config file.
This is the app.config file:
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="backup"
type="OrderConfiguration.BackupConfig, Order.Configuration.Net"/>
<section name="general"
type="OrderConfiguration.GeneralConfig, Order.Configuration.Net"/>
<section name="security"
type="OrderConfiguration.SecurityConfig, Order.Configuration.Net"/>
<-- ** THIS IS LINE 6 **
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup>
<backup configSource="config\backup.config"/>
<general configSource="config\general.config"/>
<security configSource="config\security.config"/>
<connectionStrings>
<clear/>
<add name="OrderDb"
connectionString="Data Source=(local);Initial Catalog=OrbitOrder;
User Id=User;Password=Pass;MultipleActiveResultSets=true;"/>
</connectionStrings>
</configuration>
I also confirm that config\security.config exists in the target folder.
I have spent three hours trying to figure out what the error means as all files actually exist in the target folder. I actually copied the WIX set up from a prior solution that I worked on a year ago and that one works fine without any issues.
The custom action that is failing is trying to encrypt the security configuration section.
I am at a loss to explain why MSI is throwing a 1603 error when there doesn't appear to be anything amiss.
I managed to resolve this after adding the following code to the Wix custom action:
AppDomain.CurrentDomain.AssemblyResolve += ( sender, args ) =>
{
return Assembly.LoadFrom( string.Format( #"{0}Order.Configuration.Net.dll", installFolder ) );
};
This basically says to load the assembly when it encounters a reference that needs resolving.
As per the log, the error is returned by the custom action written by you, so please debug the custom action dll during installation. Easiest method of debugging custom action is to add a message box in the code (begin of custom action) and attach to process in visual studio when the message box is displayed. other way is to use MsiBreak environment variable as described in http://msdn.microsoft.com/en-us/library/aa368264%28v=vs.85%29.aspx
I'm seeing an inscrutable compile error in my ASP.NET application.
Project file must include the .NET Framework assembly 'WindowsBase, PresentationCore, PresentationFramework' in the reference list
That's the WPF assembly. My project is ASP.NET. Has anyone ever encountered this before?
Even stranger, the project was compiling before I started messing around with my .resx files due to a different issue. Then suddenly this nonsensical error appeared.
This happens if you have a file in your project with its Build Action set to Resource. (which is used for WPF embedding)
Find the offending file and change its Build Action.
I had the following in the csproj file:
<Page Include="BuildProcessTemplates\DefaultTemplate.11.1.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="BuildProcessTemplates\LabDefaultTemplate.11.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="BuildProcessTemplates\UpgradeTemplate.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
Changing it to below fixed the problem:
<Content Include="BuildProcessTemplates\DefaultTemplate.11.1.xaml" />
<Content Include="BuildProcessTemplates\LabDefaultTemplate.11.xaml" />
<Content Include="BuildProcessTemplates\UpgradeTemplate.xaml" />
I want to enable "Directory Browsing" for the for the following virtual web directory using WIX.
<iis:WebVirtualDir Id="LogsVirDir" Alias="Logs" Directory="ESGLOGFILES" />
How do I accomplish this using WIX?
Wouldn't a simpler solution be to use the web.config system.webserver property like :
<directoryBrowse enabled="true"/>
Based on my research Wix currently does not have any capability to enable Directory Browsing using the standard set of actions. The one way I have found to do this is using a combination of Wix Custom Actions and IIS's Appcmd.exe. Note this command will create a web.config file if one does not exist.
<CustomAction Id="EnableDirectoryBrowsing"
Execute="deferred"
ExeCommand='[WindowsFolder]system32\inetsrv\APPCMD.EXE set config "ESG Website/logs" /section:directoryBrowse /enabled:true'
Directory="TARGETDIR"
Return="check"
Impersonate="no"/>
<InstallExecuteSequence>
<Custom Action="EnableDirectoryBrowsing" Before="InstallFinalize">Not Installed</Custom>
</InstallExecuteSequence>
Im using wix v3.8
try adding ConfigurableDirectory in your Feature
ex: <Feature Id='TestName' Title='Test Web' ConfigurableDirectory='INSTALLDIR' Level='1'>
Use the following code
<Control Id="Browse" Type="PushButton" X="304" Y="210" Width="56" Height="17" Text="!(loc.CustomizeDlgBrowse)">
<Publish Event="SelectionBrowse" Value="BrowseDlg">1</Publish>
</Control>
Take the value of this in the variable you want and use it.