In .NET Core 2 Web API app, Publish to folder feature in MS VS 2017 produce:
<ProjectAssembly>.PrecompiledViews.dll
<ProjectAssembly>.PrecompiledViews.pdb
Offical docs says that PrecompiledViews related to precompiling Razor Views, but my API doesn't contain any views or static files, just REST endpoints that return json.
Using .Net reflector I found the PrecompiledViews.dll empty.
So I deleted PrecompiledViews.dll and tested my API and it seems to work fine without any warnings or exceptions.
Is it safe to delete PrecompiledViews.dll and pdp if the API not using any razor views? If yes, Is there option in VS 2017 to stop publishing unused PrecompiledViews?
You are right, the precompile step always emits an assembly and doesn't check if there are actually views. You can disable the precompilation step by putting this into your csproj file:
<PropertyGroup>
<MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish>
</PropertyGroup>
This will then activate the normal copilation context preservation (refs subfolder). To deactivate this as well, add
<PreserveCompilationContext>false</PreserveCompilationContext>
to the property group.
Related
I have created a AutoCAD custom .net dll for the desktop version which had some operation.
Adding multiple empty drawing documents.
Opening the existing drawing document and copying the required blocks in the newly created drawing document.
Performing some operation on them, discarding all the unnecessary drawing documents and saving one of them as an output drawing document.
I had a query regarding opening the existing document and adding the empty document using Design Automation API but I couldn't achieve it with Design Automation.
As I explored I found that only AcCoreMgd.dll and AcDbMgd.dl are allowed with accoreconsole.exe.
Load custom .net dll inside accoreconsole.exe
DLL's used by AutoCAD custom .net project for desktop version are (AcCoreMgd.dll,AcCui.dll,AcDbMgd.dll,AcMgd.dll,AcTcMgd.dll,AdUIMgd.dll)
I wanted to use all the above DLL's with Design Automation for AutoCAD.
Will you please let us know how we can use desktop versions like support in Design Automation for AutoCAD?
It is not possible to add other modules when working with Design Automation or AccCoreConsole. Please note AcCoreConsole is a Headless part of AutoCAD in other words no UI libraries are permitted. Following are the libaries that a crx app should bind.
Where XX - module version of AutoCAD release for more details
If you are developing a .NET module, you need to use following Nuget
ac1stXX.lib
acdbXX.lib
acdbmgd.lib
AcDbPointCloudObj.lib
acgeXX.lib
acgiapi.lib
acismobjXX.lib
AcMPolygonObjXX.lib
AcSceneOE.lib
axdb.lib
rxapi.lib
acbrXX.lib
acgexXX.lib
AdImaging.lib
AdIntImgServices.lib
AecModeler.lib
AsdkHlrApiXX.lib
acapp_crx.lib
AcCamera.lib
accore.lib
AcFdEval.lib
AcPublish_crx.lib
Why do you need to open mutilple documents ?, you can insert multiple blocks from different drawings in to Host drawing. Make modifications, save and send to your Server.
I used to embed some of my Razor views for mailing in a class library which was using ASP .Net Core 2.1.0-preview1-final and it was working fine.
Here is the configuration in the .csproj file:
Since I upgraded the .Net Core version to 2.1.1 which is the final one, I can not use the embedded views anymore.
I know about the new Razor Class Library concept but I need to pass my views to a ViewRenderer service which basically converts the view to string to be sent as an email.
The viewrenderer service was finding the views before but now it doesn't find them and I get the following error:
VIEW does not match any available view
How can I fix this issue?
I was facing the exact same issue, setting CopyRefAssembliesToPublishDirectory to true in the csproj file fixed it. your csproj file should look like this :
...
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<CopyRefAssembliesToPublishDirectory>true</CopyRefAssembliesToPublishDirectory>
</PropertyGroup>
...
Is there a way I can compile all my razor views (to verify) any time I need? I found this doc which shows how it compiles on publish https://learn.microsoft.com/en-us/aspnet/core/mvc/views/view-compilation?view=aspnetcore-2.1&tabs=aspnetcore2x.
I am looking for an option within visual studio or even better via CLI that compiles and validates all views. I did find this official razor CLI tool in preview, but no documentation: https://www.nuget.org/packages/Microsoft.AspNetCore.Razor.Tools/1.1.0-preview4-final
Well, you can publish any time you need. The name ‘publish’ does not mean ‘push my site to the coliseum of public opinion’ :-)
All that it does stays local, and dotnet publish will by default create a directory under your project bin folder with, as you say, compiled views and other artefacts.
Per this comment, with .NET core 2.1 you can compile razor views at build time without needing to publish, by adding these two lines to the <PropertyGroup> section of your project file:
<RazorCompileOnBuild>true</RazorCompileOnBuild>
<ResolvedRazorCompileToolset>RazorSdk</ResolvedRazorCompileToolset>
This will cause them to compile to a [project].Views.dll, and you'll no longer need to distribute the cshtml files.
The project is your standard run-of-the-mill ASP.NET MVC 3 application that communicates with an in house WCF service. Our ASP.NET MVC application references a few external libraries, including the popular JSON.NET library.
The issue only occurs when the JSON.NET library is a reference in a project. I tried recreating this issue with a WebForms and a Windows Forms project, and the same thing happens.
When adding a service reference to our WCF service, and JSON.NET is a reference in our project, it builds the service reference like this:
With JSON.NET referenced in the project - notice the Request/Response Classes and the weird properties like Id1 and IdSpecified
But removing the reference to JSON.NET and updating the service reference builds it the way we want, like this:
Without JSON.NET referenced in the project
...
What in the world would cause this? JSON.NET is not referenced in the WCF project, so I highly doubt that there could be some sort of mix up there.
Some information that may help:
Tried checking various options in the Add Service Reference dialog such as "Reuse types in referenced assemblies" - but the same thing happens
Visual Studio 2010
WCF service uses Entity Framework for data access
When you add a service reference, WCF by default will reuse the classes from your assemblies that match the ones that will be generated otherwise.
This happens because, for example, you might develop both the service and the client and you might want to have a class library with all the classes referenced in both projects. This also makes sure that .NET default types (like arrays, lists, DateTime) are used.
You can change this default behavior like this:
Click the Advanced button after you selected "Add service reference"
Select "Reuse types in specified referenced assemblies"
Check all the assemblies, except the ones that you don't want to
use
Note that if you don't check the system assemblies, you will get a new type generated in the proxy file for every .NET type (like arrays, lists) as well.
The question is how to resolve conflicts between versions of assemblies in my project that was upgraded to MVC4 and EF5?
The problem is manifest in the fact that my controllers and models can include System.Data.Objects, but now my views.
I am using MVC 4, my project was upgraded from MVC 3.
Entity Framework is version 5.
I have a controller that is able to use objectcontext from System.Data.Objects.
My Usings:
using System.Data.Objects;
using System.Data.Entity;
When I try to include the using in the view form System.Data.Objects, I get :
CS0234: The type or namespace name 'Objects' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
I am targeting .net 4.5
My Build Displays this message:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1561,5): warning MSB3247: Found conflicts between different versions of the same dependent assembly.
You can build your solution in diagnostic mode to get more detailed information about the error.
Open the VS Options dialog (Tools > Options), navigate to the "Projects and Solutions" node and select "Build and Run". Change the MS Build project build output verbosity to Diagnostic.
Have a look here.
If you look at the build message, it states the 4.0 version of the .net framework is referenced... Is there a setting in your project file or web/app.config specifying a conflicting version of the .net framework?
Are you familiar with fuslog? you can set it up to log all assembly bindings that .net is doing while running your application. You should then be able to see detailed information on what is getting bound when. If you still can't figure it out, you can always do a binding redirect on that .dll in the web.config.
http://msdn.microsoft.com/en-us/library/eftw1fys.aspx -- binding redirects
http://msdn.microsoft.com/en-us/library/e74a18c4(v=vs.71).aspx -- fusion log viewer
Set up fusion logger and take a look at what the output is. If you don't get an answer from that, try the binding redirect (which would give you at least a temporary solution).
In the directory I was publishing to, there was a folder named aspnet_client. I moved it (instead of deleting it), republished, and it worked. I'm not sure why that folder decided to give me trouble out of the blue.