I use VSIX wizard extension.
Everything is functioning for one assembly. But when I want to have WizardAssemblyDetail (for DetailForm) and WizardAssemblyView (for ViewForm) and one assembly referenced from the other two (for ex. WizardAssemblyBase).
When I export it with a wizard, I cannot run the wizard because of "Could not load file or assembly 'WizardAssemblyBase' or one of its dependencies."
I tells that the WizardAssemblyBase.dll is not copied.
Is there a way how to solve it? Or some workaround?
Thanks in advance
You should add your Assemblies References in the Assets elements of your .vsixmanifest file.
In PackageManifest add :
<Assets>
<Asset Type="Microsoft.VisualStudio.ProjectTemplate" Path="ProjectTemplates" />
<Asset Type="Microsoft.VisualStudio.Assembly" Path="TemplateWizard\YourTemplateWizard.dll" AssemblyName="YourTemplateWizard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=4dbd4c10d49bc550" />
<Asset Type="Microsoft.VisualStudio.Assembly" Path="TemplateWizard\NuGet.Core.dll" AssemblyName="NuGet.Core, Version=2.8.50506.491, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<Asset Type="Microsoft.VisualStudio.Assembly" Path="TemplateWizard\Microsoft.Web.XmlTransform.dll" AssemblyName="Microsoft.Web.XmlTransform, Version=2.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</Assets>
Related
I'm trying to create a custom checkin policy in TFS 2013. Followed this example and I create WorkitemStateControlPolicy class below
https://blog.devart.com/creating-tfs-custom-check-in-policy.html
namespace WIStateControlPolicy
{
[Serializable]
public sealed class WorkitemStateControlPolicy : PolicyBase
{
[NonSerialized]
private IPendingCheckin pendingCheckin;
public const string ClosedStatus = "System.Reason";
........
........
}
}
I build this project, WorkitemStateControl.dll created. Registy key I am using:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\14.0_Config\TeamFoundation\SourceControl\Checkin Policies]
"WorkitemStateControl"="c:\\Users\\me\\Desktop\\dll\\WorkitemStateControl.dll"
Then I checked the visual studio 2015 add checkin policy but new policy is not visible in list
I tried also this registy path:
(HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\11.0\TeamFoundation\SourceControl\CheckinPolicies)
But problem not changed.
My queston is, why new checkin policy is not visible? Should I change anything on tfs server?
There is not really a concept of a Check-in policy to go hand-hand with a version of Team Foundation Server. Instead these are plugins for Visual Studio. So you'rn buiding a plugin for that specific version of Visual Studio that happens to connect to a Team Foundation Server.
A such, each version of Visual Studio needs its own versions of the assemblies, compiled against the correct version of .NET and the correct version of the Team Foundation Server Client Object Model that matches the version that ships with the Team Explorer "extension" for Visual Studio.
You then register a different path to the specific assembly containing the policy into each registry tree of the version of Visual Studio you support. Ohh and don't forget to register the x86 and the x64 registry trees :).
Windows Registry Editor Version 5.00
//v12
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12.0\TeamFoundation\SourceControl\Checkin Policies]
"JesseHouwing.CheckinPolicies"="C:\Program Files(x86)\\MyCompany\\Checkin Policies\\v12.0\\JesseHouwing.CheckinPolicies.dll"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\12.0\TeamFoundation\SourceControl\Checkin Policies]
"JesseHouwing.CheckinPolicies"="C:\Program Files(x86)\\MyCompany\\Checkin Policies\\v12.0\\JesseHouwing.CheckinPolicies.dll"
//v14
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0\TeamFoundation\SourceControl\Checkin Policies]
"JesseHouwing.CheckinPolicies"="C:\Program Files(x86)\\MyCompany\\Checkin Policies\\v14.0\\JesseHouwing.CheckinPolicies.dll"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\14.0\TeamFoundation\SourceControl\Checkin Policies]
"JesseHouwing.CheckinPolicies"="C:\Program Files(x86)\\MyCompany\\Checkin Policies\\v14.0\\JesseHouwing.CheckinPolicies.dll"
etc...
All the details are in this blog post.
VISUAL STUDIO PROJECT TYPE CPU .NET VERSION TFS OM VERSION VISUAL STUDIO VERSION
2017 Class Library AnyCPU 4.6 15.0.0.0 v15.0
2015 Class Library AnyCPU 4.6 14.0.0.0 v14.0
2013 Class Library AnyCPU 4.5 12.0.0.0 v12.0
2012 Class Library AnyCPU 4.0 11.0.0.0 v11.0
2010 Class Library AnyCPU 4.0 10.0.0.0 v10.0
2008 Class Library AnyCPU 3.0 9.0.0.0 v9.0
2005 Class Library AnyCPU 2.0 8.0.0.0 v8.0
And a sample project that targets multiple Visual Studio Versions.
In this project I've manually tweaked the project files to dynamically reference the version of the Client Object Model depending on the selected Visual Studio version using a choose/when construct:
<Choose>
<When Condition="'$(Configuration)' == 'VS2013'">
<ItemGroup>
<Reference Include="Microsoft.TeamFoundation.VersionControl.Client, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Microsoft.TeamFoundation.Client, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Microsoft.TeamFoundation, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
</ItemGroup>
</When>
<When Condition="'$(Configuration)' == 'VS2012'">
<ItemGroup>
<Reference Include="Microsoft.TeamFoundation.VersionControl.Client, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Microsoft.TeamFoundation.Client, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Microsoft.TeamFoundation, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
</ItemGroup>
</When>
<When Condition="'$(Configuration)' == 'VS2010'">
<ItemGroup>
<Reference Include="Microsoft.TeamFoundation.VersionControl.Client, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Microsoft.TeamFoundation.Client, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Microsoft.TeamFoundation, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<Reference Include="Microsoft.TeamFoundation.VersionControl.Client, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Microsoft.TeamFoundation.Client, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Microsoft.TeamFoundation, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
</ItemGroup>
</Otherwise>
</Choose>
You can use similar tricks to reference different NuGet versions for later versions of Team Explorer. The TFS Aggregator project is built against every version of the Client Object Model since 2013 and we dynamically include a targets file to setup the references and nuget dependencies.
When I try to build my Asp .Net Core (1.1.2) App, I'm receiving the following warning:
Found conflicts between different versions of "System.Net.Http" that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed.
This then turns into a runtime error so I'm trying to fix this warning...
I turned on detailed logging in Visual Studio and I see this in the build output window:
There was a conflict between "System.Net.Http, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "System.Net.Http, Version=4.1.1.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
"System.Net.Http, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was chosen because it was primary and "System.Net.Http, Version=4.1.1.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was not.
References which depend on "System.Net.Http, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [C:\Users\mdepouw\.nuget\packages\system.net.http\4.3.1\ref\net46\System.Net.Http.dll].
C:\Users\mdepouw\.nuget\packages\system.net.http\4.3.1\ref\net46\System.Net.Http.dll
Project file item includes which caused reference "C:\Users\mdepouw\.nuget\packages\system.net.http\4.3.1\ref\net46\System.Net.Http.dll".
System.Net.Http
References which depend on "System.Net.Http, Version=4.1.1.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [C:\Users\mdepouw\Source\Repos\MyProject\MyProject.Services.Common\bin\x64\Debug\System.Net.Http.dll].
C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.applicationinsights.aspnetcore\2.1.1\lib\net451\Microsoft.ApplicationInsights.AspNetCore.dll
Project file item includes which caused reference "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.applicationinsights.aspnetcore\2.1.1\lib\net451\Microsoft.ApplicationInsights.AspNetCore.dll".
C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.applicationinsights.aspnetcore\2.1.1\lib\net451\Microsoft.ApplicationInsights.AspNetCore.dll
C:\Users\mdepouw\Source\Repos\MyProject\MyProject.Services.Common\bin\x64\Debug\MyProject.Services.Common.dll
Project file item includes which caused reference "C:\Users\mdepouw\Source\Repos\MyProject\MyProject.Services.Common\bin\x64\Debug\MyProject.Services.Common.dll".
C:\Users\mdepouw\Source\Repos\MyProject\MyProject.Services.Common\bin\x64\Debug\MyProject.Services.Common.dll
C:\Users\mdepouw\Source\Repos\MyProject\MyProject.Services.Common\bin\x64\Debug\MyProject.Persistence.MarkLogic.dll
Project file item includes which caused reference "C:\Users\mdepouw\Source\Repos\MyProject\MyProject.Services.Common\bin\x64\Debug\MyProject.Persistence.MarkLogic.dll".
C:\Users\mdepouw\Source\Repos\MyProject\MyProject.Services.Common\bin\x64\Debug\MyProject.Services.Common.dll
... more dlls that reference 4.1.1.2
Dependencies
I don't understand the part that tells me which "References" depend upon System.Net.Http, Version=4.1.1.0. I'm reading it as it depends upon itself. What am I misunderstanding?
I'm not referencing System.Net.Http directly either via Assembly references nor as a Nuget reference.
Also, the file in "C:\Users\mdepouw.nuget\packages\system.net.http\4.3.1\ref\net46\System.Net.Http.dll" is version 4.1.1.0.
Update: The original fix worked for my WebApi but didn't work for Viewing MVC Pages. I started to receive another runtime exception: Can not find assembly file Microsoft.CSharp.dll.
I changed <DependsOnNETStandard>true</DependsOnNETStandard> to <DependsOnNETStandard>netstandard1.6</DependsOnNETStandard> and that resolved the issue.
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net462</TargetFramework>
<RuntimeIdentifier>win7-x64</RuntimeIdentifier>
<IsServiceFabricServiceProject>True</IsServiceFabricServiceProject>
<AssemblyName>MyProject</AssemblyName>
<Platforms>AnyCPU;x64</Platforms>
<DependsOnNETStandard>netstandard1.6</DependsOnNETStandard>
</PropertyGroup>
...
</Project>
Original Answer:
I added <DependsOnNETStandard>true</DependsOnNETStandard> per this GitHub Issue and my build warning went away and so did my runtime error.
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net462</TargetFramework>
<RuntimeIdentifier>win7-x64</RuntimeIdentifier>
<IsServiceFabricServiceProject>True</IsServiceFabricServiceProject>
<AssemblyName>MyProject</AssemblyName>
<Platforms>AnyCPU;x64</Platforms>
<DependsOnNETStandard>true</DependsOnNETStandard>
</PropertyGroup>
...
</Project>
I don't understand the part that tells me which "References" depend upon System.Net.Http, Version=4.1.1.0. I'm reading it as it depends upon itself. What am I misunderstanding?
That because one of dependencies for Microsoft.AspNetCore drags in NETStandard.Library 1.6 which adds tons of System.* dependencies:
There was a conflict between “System.Net.Http”
This is a known issue about .NET core:
System.Net.Http package 4.3.2 - redirect to 4.2.0.0, assembly loading failure
This issue will be fixed in the next version 2.1.0.
The current workaround provided by Tornhoof:
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.1.2" newVersion="4.1.1.2" />
</dependentAssembly>
</assemblyBinding>
It uses the dll from the build extensions directory and not the one from Nuget.
I am using Visual Studio 2010 and I installed "Microsoft Report Viewer 2012 Runtime" hoping to test the new reporting system in SQL 2012. After which I cleared for ref to "Microsoft.ReportViewer.WebForms" from my Web.config and removed the ReportViewer control from my toolbox and added the new version 11 ReportViewer.
I added the new control to a testing page and for one it adds this register to the test page:
<%# Register Assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
and it adds these entry to the Web.config:
<buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</buildProviders>
<httpHandlers>
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false" />
</httpHandlers>
<handlers>
<add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</handlers>
The control in the toolbox is the version 11 addition but the system keeps trying to ref the verion 10 edition. Also when I try to compile it I get the error:
The type 'Microsoft.Reporting.WebForms.ReportViewer' exists in both 'c:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\10.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll' and 'c:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\11.0.0.0__89845dcd8080cc91\Microsoft.ReportViewer.WebForms.DLL'
I think I had the exact same problem. If so, my solution was to delete all entries in web.config referencing ReportViewer, then do the same in References, build the project and then re-ADD a reportviewer in the page.
web.config will update with new handlers and assemblies for the newer version.
I had the same error, and resolved it by doing the following:
In the aspx page (HTML code), updated the #Register Version value to correspond to the version of the assembly I was using, and updated the PublicKeyToken value with the correct value for the assembly.
In your web config, it means you have specified both v 10 and 11 dlls. Remove one or the other.
I have removed the following entry from package.config and it works
<package id="MicrosoftReportViewerWebForms_v10" version="1.0.0" targetFramework="net45" />
I'm writing a small test project in order to get my feet wet with EF code first. Unfortunately, when I try compiling, I get the following error:
Assembly 'Backend, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses
'EntityFramework, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
which has a higher version than referenced assembly 'EntityFramework, Version=4.1.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' c:\Users\Kevin\Documents\Visual
Studio 2010\Projects\CFTest\Backend\bin\Debug\Backend.dll CFTest
For some reason, there's a versioning conflict, but I dunno how to fix it.
EDIT: My App.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">
<parameters>
<parameter value="Data Source=.\SQLEXPRESS; Integrated Security=True; MultipleActiveResultSets=True" />
</parameters>
</defaultConnectionFactory>
</entityFramework>
</configuration>
My backend project had one version of EF while my MVC project came with another by default. Solved.
It is conflict with the version of the .NET framework your project is using, and the version of the .NET Framework that the EF dll was compiled in. If you go to the add reference window for the project, the listing should say what .NET Framework version each DLL uses. Change you project target to use that version as well.
Working against the current RC2 - the template that is generated Razor views includes:
#{
ViewBag.Title = "Details1";
Layout = "/Views/Shared/_Public.cshtml";
}
With a red squiggly under ViewBag.Title and this compiler error:'
Error 4 One or more types required to compile a dynamic expression cannot be found. Are you missing references to Microsoft.CSharp.dll and System.Core.dll? c:\Visual Studio 2010\Projects\myProj\Views\Webinar\Details1.cshtml 6 2 TTSTrain.Webinars.WebEntry
But the project builds and functions correctly. Is the error indicative of other problems that should be addressed?
I got the same problem after I removed the targetFramework attribute from the <compilation> element in the Web.config file.
Once I restored it to
<compilation debug="true" targetFramework="4.0">
Everything worked fine again!
I solved it in the following way:
First i noticed using gacutil (Global Assembly Cache Utility) that it contained two references to System.Core, one to version 4.0 and one to version 3.5. Apparently inside the razor views, even if in the project i had the correct reference to version 4.0, it was still using version 3.5 and that's why i was getting the error about the dynamic types.
To check if that's your case open as administrator Visual Studio Command Prompt and execute:
gacutil -l System.Core
To remove the reference to the old version of System.Core i did the following steps:
- cd %systemroot%\assembly\
From here you may have more that one "gac" directory, so you will have to search within each to find your component. For me, it was within the "gac_MSIL" directory.
- cd gac_msil
- cd System.Core
- cd <assembly version number>__<public key token>
- erase *.* Say "y" to are you sure.
- cd ..
- rd <assembly version number>__<public key token>
- cd ..
- rd System.Core
After that I opened my solution again in visual studio and the error was gone, it references properly to System.Core 4.0 and I was not getting the dynamic errors anymore :)
I hope it will help you as well,
Best, N.
Similar to #Kaiser's answer, I experienced this problem as a result of having multiple System.Core assemblies in the GAC.
I chose not to delete the 3.5 assembly, however. Instead, in the Views web.config, I modified the configuration/system.web/compilation node as follows:
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
</assemblies>
</compilation>
The important line is the last assembly node: it tells the Razor compiler which GAC assembly version to use.
Once I did this, all was well in my Razor views.
I do not have this problem when running VS 2012 as administrator.
Otherwise, what worked for me:
in root web config have added as recommended reference to correct assembly as child of compilation node`
<system.web>
<compilation debug="true" targetFramework="4.5">
<assemblies>
<add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</assemblies>
</compilation>
</system.web>
set copy local = true properties for System.Core and Microsoft.CSharp`
Do you have a reference to Microsoft.CSharp and System.Core?
MVC Views (usually) get compiled dynamically when you access your site, not when you compile the application in VS. I imagine you will see issues when running the site. Just add the two references and you should be fine.
By using Peters answer i managed to solve the issue with Html.EditorFor(m => m.xxx) underline errors in the chtml files.
Althought the ViewBar error persisted.
So i changed the web.config like this
<compilation debug="true" targetFramework="4.5.1">
<assemblies>
<add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<add assembly="Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</assemblies>
</compilation>
Notice the Microsoft.Csharp line.
The above did the trick and now the chtml editor is clear from the red underlines.
Thanks Peter
I had the exact same problem. By default, when you create an MVC3 app it sticks a web.debug.config and a web.release.config in the solution. When I got rid of those two items, the ViewBag issue resolved itself. It may have something to do with what Peter was saying above but I didn't test that.
That is the time when other fields in ViewBag is read. So if you are passing them from controller.
ViewBag.yourobjectDto = yourObjectDto;
make sure this line is not blocked through if condition or something.
Try
Page.Title = "Details1";
It might work.