Could not find System.Object VB.NET - vb.net

Error : Fody: Could not find 'System.Object'. WindowsApp1
hi, something called Fody, it embed dlls assembly into project.
problem is it work only with C# |and i need use it as VB, i cant reduce Netframwork less than 4.6 cause dll's required high netframwork.
error only occurs when running Fody on a VB assembly using the full .Net Framework
so they say it can be solve By
try adding explicit references to your VB project
<Reference Include="mscorlib" />
<Reference Include="System" />
how can do it, because not automatically included in VB projects

Go to your Project file
edit vbproj
you can find <Reference Include="System" />
add before it <Reference Include="mscorlib" />

Related

Targeting C++/CLI project to .Net 6.0 - Error : Project does not reference "native,Version=v0.0" framework

Am upgrading my WPF project to .Net 6 which internally refers C++/CLI project. So am trying to upgrade my C++ project also to .Net6.0.
Changed the below properties in .vcxproj
<CLRSupport>NetCore</CLRSupport>
<TargetFramework>net6.0-windows</TargetFramework>
While building the project, it fails with the below error.
Your project does not reference "native,Version=v0.0" framework. Add a reference to "native,Version=v0.0" in the "TargetFrameworks" property of your project file and then re-run NuGet restore.
Anyone please guide me on - referring a C++ project (.Net Framework 4.6) in .Net 6.0
Do we need to upgrade c++ library to .Net 6.0 to consume it in .Net6.0 apps
How can we add reference to “native, Version0.0” in TargetFrameworks
When I made my project changes to get a C++/CLI-based assembly to build using .NET 6, I had the CLRSupport and TargetFramework changes like you show. But, I also had to change the <ItemGroup> containing the Reference elements to instead use a single <FrameworkReference> element. Note that my code called into WPF so there's a lot of those assemblies there.
Old:
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
New:
<ItemGroup>
<FrameworkReference Include="Microsoft.WindowsDesktop.App" />
</ItemGroup>

Relative Referencing in Visual Studio 2013 (vb.net)

Problem: So, my issue is that I have 3 .dll files I want to include in my software. However, whenever I transfer the .exe to another computer, it looks for my hard coded absolute path in my computer. I want the dlls to be included or embedded such that I can distribute it to others.
Setup:
I have done so by going to the solution explorer and doing Add->Exisiting Item, and add the three dlls into the solution explorer.
Then I went to each .dll's properties and changed them so that they are considered embedded resources. Like so:
Then I went to the references tab of the project property, and added a reference to the three dlls in my code. I originally had them in my /bin/ folder of my project, but I still had this problem. so I added them here in the same folder as my project.
Great, so I compile, copy to another computer, and get an exception (I threw it to a message box for ease) saying it can't find the dll and/or its dependencies. I even put a copy of the dll in the same .exe folder on the separate computer, but the same problem.
What I've Tried: So I tried messing around with the project file. But it looked ok to me. Here's a snippet:
<ItemGroup>
<Reference Include="PcapDotNet.Base, Version=0.10.0.20588, Culture=neutral, PublicKeyToken=4b6f3e583145a652, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>.\PcapDotNet.Base.dll</HintPath>
</Reference>
<Reference Include="PcapDotNet.Core, Version=0.10.0.20632, Culture=neutral, PublicKeyToken=4b6f3e583145a652, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>.\PcapDotNet.Core.dll</HintPath>
</Reference>
<Reference Include="PcapDotNet.Packets, Version=0.10.0.20603, Culture=neutral, PublicKeyToken=4b6f3e583145a652, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>.\PcapDotNet.Packets.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
and later ...
<ItemGroup>
<EmbeddedResource Include="PcapDotNet.Base.dll" />
<EmbeddedResource Include="PcapDotNet.Core.dll" />
<EmbeddedResource Include="PcapDotNet.Packets.dll" />
</ItemGroup>
Question: So, why is it saying it can't find the dll? Where could it still be looking for it in the wrong place?
Thanks everyone!
Thanks for the help guys! I found the solution was a problem with Pcap dot net (pcap.net). The issue was that the supporting computer didn't have the Microsoft Redistributable C++ package. It says that is needed on their website. I thought that was for development only, but turns out it is needed for running as well. I might try to include those dll's in the embedded resources as well to clean it up for the user.

Visual Studio Add Reference - UAC path

I have read the following webpage: http://msdn.microsoft.com/en-us/library/ee817675.aspx and I am interested in the section: 'Use File References Only Where Necessary'
The section seems to suggest that you can add a reference to a DLL on a server. I have version 11 of Oracle.DataAccess on my development PC and version 10 on the live server. It is a pain to deploy the application.
The web page says that a project file should contain a 'References' node, but when I right click on a project file and open with TextPad, there is only an ItemGroup (http://msdn.microsoft.com/en-us/library/646dk05y%28v=vs.90%29.aspx) node. Therefore I have two questions:
1) Where can I find the References node as stated on the webpage?
2) Is it possible to reference an assembly using the UAC path instead of a local path?
Referenced projects is placed in ItemGroup starting from MSBuild 2.0 first link is outdated it from Visual Studion .NET times .NET 1.0/1.1.
<ItemGroup>
<!-- ... -->
<Reference Include="System" />
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
</Reference>
<!-- ... -->
</ItemGroup>
For the second question I think yes if you mean UNC path.

MSBuild: building website using AspNetCompiler - adding references?

I'm attempting to build a ASP.NET website using MSBuild - specifically the AspNetCompiler tag. I know that, for my project, I need to add some references. Within Visual Studio I have several references, one is a project reference and the others are some DLLS (AjaxControlToolkit etc). I'm happy not referencing the project and referencing the DLL instead - however I just can't work out how to add a reference. I've looked up and down and this is what I've found so far:
<Target Name = "PrecompileWeb">
<AspNetCompiler
VirtualPath = "DeployTemp"
PhysicalPath = "D:\AutoBuild\CruiseControl\Projects\Websites\MyCompany\2.0.0\WorkingDirectory\VSS"
TargetPath = "D:\AutoBuild\CruiseControl\Projects\Websites\MyCompany\2.0.0\PreCompiled"
Force = "true"
Debug = "true"
Updateable = "true"/>
</Target>
Also - I've picked up this bit of code from around the web somewhere, which I thought might help:
<ItemGroup>
<Reference Include="My.Web.DataEngine, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\AutoBuild\CruiseControl\Projects\Components\My.Web.DataEngine\bin\Debug\My.Web.DataEngine.dll</HintPath>
</Reference>
</ItemGroup>
What I want to do is add a attribute to the AspNetCompiler tag, something like:
References="#(Reference)"
but MSBuild isn't very happy about this.
I've been a bit stuck in not being able to find decent references on doing this anywhere: so I'd really apprechiate some pointers or reference material etc. (or just the answer!)
Thanks for you help.
-tom
The aspnet_compiler tool doesn't have a reference property.
Have you looked at using Web Deployment Projects (2005 version)?
You can add references to assemblies used during the compilation of an ASP.NET application by adding to the <assemblies> element, under <compilation> if your web.config. For example:
<compilation targetFramework="4.6.2" debug="true">
<assemblies>
<add assembly="System.Web.Mvc, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
Read more here: https://learn.microsoft.com/en-us/previous-versions/dotnet/netframework-4.0/bfyb45k1(v=vs.100)

.NET Different References List for Debug / Release

In my debug build I have a reference to a DLL that is only required in the Debug configuration (the reference is for CodeSite, a logging tool).
Is it possible to exclude this reference in the Release build (my logging class only uses this reference when built in the Debug configuration).
Using VB.NET and VS2008.
Yes this is possible but it will require you to manually edit the .vbproj file. Once you have the file open you'll an XML reference tag for the DLL's you've referenced and it will look like the following
<Reference Include="SomeDllName" />
You need to add a condition property which species it should only be done during debug time
<Reference Include="SomeDllName" Condition="'$(Configuration)'=='Debug'" />
It's possible to do this, but you'll need to mess with the project file manually.
We do this in MiscUtil so we can have a .NET 2.0 build and a .NET 3.5 build. For instance:
<ItemGroup Condition=" '$(Configuration)' != 'Release 2.0' ">
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
<Aliases>global</Aliases>
</Reference>
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
</ItemGroup>
That should be enough to get you started :) Basically take the current reference out of where it is in your normal project file, and put it in its own ItemGroup with an appropriate condition.