I had installed Fluent Assertions v.3 on the unit tests project and all was good until i had to update it to v.5.
After that i get:
Obj does not contain a definition for 'ShouldBeEquivalentTo' and no
extension method 'ShouldBeEquivalentTo' accepting a first argument of
type 'Obj ' could be found (are you missing a using directive or an
assembly reference?)
I have seen on https://www.nuget.org/packages/FluentAssertions it needs .NET 4.5 and i set this on packages.config:
<package id="FluentAssertions" version="5.0.0" **targetFramework="net45"** />
and on csproj as follow:
<Reference Include="FluentAssertions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL"> <HintPath>..\packages\FluentAssertions.5.0.0\lib\net45\FluentAssertions.dll</HintPath> </Reference>
But i still got the same error. What i am doing wrong?
Thanks for help.
If Obj implements IComparable<T> it's probably this issue which has been fixed in the source.
Can you provide an example of the test, that no longer compiles?
Related
We have a Umbraco website that references Umbraco.Web.UI,
<Reference Include="Umbraco.Web.UI, Version=8.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\UmbracoCms.Web.8.12.2\lib\net472\Umbraco.Web.UI.dll</HintPath>
</Reference>
If we see the source code of Umbraco.Web.UI, then we see there is copy action that generates web.config from web.Template.config.
https://github.com/umbraco/Umbraco-CMS/blob/34e80d86e8c0b754f6b7a02e307f53cb32806bbe/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj#L369
But as far as I know if I just reference Umbraco.Web.UI.dll then these MSBuild actions in Umbraco.Web.UI.dll will not run.
My question is that how come web.config is generated if I build the project and web.config is missing.
The problem is that we have removed web.config from the repository and we wanna to understand how this web.config is generated so that we can modify it when we deploy.
So my csproj is using,
<Import Project="..\packages\UmbracoCms.8.12.2\build\UmbracoCms.targets"
and UmbracoCms.targets have the below action
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" />
VSTS build of my ASP.NET Core 2.0 MVC app fails with these warnings:
Warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.AspNetCore.Mvc.ViewFeatures".
Warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.Extensions.Logging.Abstractions". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
Warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.Data.SqlClient". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
And then I get compilation error like these:
The type or namespace name 'Extensions' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
Error CS0246: The type or namespace name 'ILogger' could not be found (are you missing a using directive or an assembly reference?)
and so on for ILoggerFactory, SqlDataReader, etc. And everything builds perfectly on my machine locally. What am I missing?
First please make sure the PackageReference in .csproj are not refer the local paths. It should like:
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.ViewFeatures" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="2.0.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.4.0" />
Then please use ASP.Net Core template to define your build definition:
With the .NET Core tasks to restore, build, test and publish, and you can also add other tasks for your needs.
I'm getting the above error from our TeamCity build.
I have tried adding the following lines to the web.config.
<assemblies>
<add assembly="System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</assemblies>
I have also installed the latest Windows SDK for .NET4.5.2.
Neither of these have resolved the error.
Any ideas?
Finally found a solution to this problem. I added a reference to the System.Runtime.dll assembly to my project. I added a reference to the following file to my project (substitute your own version of .NET in the path as necessary). You could always copy the file to your project folder and link it from there as an alternative.
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades
This worked for me and hopefully will work for someone else.
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)