Using TFS Build Extensions 2010 Azure in TFS Build Process Templates - tfs

I'm attempting to use the community TFS Build Extensions Azure activities to deploy to Azure as part of a TFS Build.
I've added activities from TfsBuildExtensions.Activities.dll and TfsBuildExtensions.Activities.Azure.dll and I'm able to any activity from TfsBuildExtensions onto my build process and they work properly
The problems start when I drag an activity from TfsBuildExtensions-Azure. The activity's title in the Gui display remains blank except for the generic activity icon. The properties pane shows that the properties for this activity cannot be edited. Finally, upon saving this build process template, it fails with the following error:
System.IO.FileNotFoundException: Could not load file or assembly 'ServiceManagement, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'ServiceManagement, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
at System.Signature.GetSignature(SignatureStruct& signature, Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
at System.Signature..ctor(IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
What am I doing wrong or what reference am I missing?

I downloaded the source of the project and found that there is a reference to a ServiceManagement.dll in the project file, and the dll can be found in their source control.
Downloading the dll from their source, and adding it to the project references has resolved the issue.
I found a reference on MSDN Blogs to a ServiceManagement.dll that revolves around deployment to azure, but it seems the original sources for the dll have disappeared.

Idea- confirm that you are using .NET 4.0 Framework target and not .NET 4.0 Client Profile. Sometimes the latter causes seemingly 'obvious' assemblies to fail to load because they have dependencies that are not in client profile.
Not a solution per se, but for another way of going about debugging, you might want to turn on fusion logging and use Fusion Log Viewer to view assembly binding errors. At least that will tell you where the runtime is looking for these assemblies that it isn't finding.
Here are some clear instructions from Scott Hanselman on how to do this:
http://www.hanselman.com/blog/BackToBasicsUsingFusionLogViewerToDebugObscureLoaderErrors.aspx

Related

Error generating QR code in ASP.net + Report viewer with QrCoder

I am trying to generate a report with Qr codes I am using this video as a guide
https://www.youtube.com/watch?v=BW99WK6SQKI
I did tests before and it worked and then it stopped working and it just shows me that error nothing more.
I am working with ASP.net MVC + Report Viewer
I looked for the error in the forums and I can't find a solution...
Error while loading code module: ‘QRCoder, Version=1.3.6.0, Culture=neutral, PublicKeyToken=null’. Details: Could not load file or assembly 'QRCoder, Version=1.3.6.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. C:\DevOps\Project\Report\Qr.rdlc
IDE
IMAGEN PROPERTIES
**REPORT PROPERTIES
PublicKeyToken value should not be null. You need to get the PublicKeyToken from QrCoder dll and use it.
To find the Public key token.
Open visual studio developer command prompt.
Run sn -Tp <AssemblyName>
e.g. sn -Tp c:\libraries\QRCoder.dll
Use Public key value in PublicKeyToken=<Value>
I faced the same error, I cleaned the project inside the solution and build it as "Release" (Because the problem appeared in the production environment), found the problem fixed.

Dotfuscator throwing error on Xamarin.Android project

I followed the steps to integrate Dotfuscator into my Xamarin.Android project as described here, but when it's time to build the project, I'm getting the following error:
The "_DotfuscatorXamarin_DetermineDefaultInputsTask" task failed unexpectedly.
2>\path\to\PreEmptive.Dotfuscator.Xamarin.targets(570,5): error MSB4018: System.NullReferenceException: Object reference not set to an instance of an object.
2>\path\to\PreEmptive.Dotfuscator.Xamarin.targets(570,5): error MSB4018: at InlineCode._DotfuscatorXamarin_DetermineDefaultInputsTask.Execute() in \path\to\AppData\Local\Temp\eruovv3u.0.cs:line 106
2>\path\to\PreEmptive.Dotfuscator.Xamarin.targets(570,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
2>\path\to\PreEmptive.Dotfuscator.Xamarin.targets(570,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()
I have looked and looked online, but no one seems to be having this issue. I think the problem has something to do with generating the default configuration file on the first build. Any ideas?
UPDATE: This issue has been fixed in newer versions of Dotfuscator. See the detailed instructions for the free Dotfuscator Community and for the commercially-licensed Dotfuscator Professional. The original answer follows below.
Full Disclosure: I am a developer of Dotfuscator at PreEmptive Solutions, and am answering this question in that role.
You're right, the problem is the default config file generation in the targets file (PreEmptive.Dotfuscator.Xamarin.targets) - sorry about that. Specifically, the build integration is attempting to discover project references, but expects the classic MSBuild project format, not the new minimal one used by .NET Standard.
You can work around this issue as follows:
In the targets file, locate the _DotfuscatorXamarinConfigTemplateLines property and copy its value (within the CDATA section) to a new file named DotfuscatorConfig.xml (or whatever value you supplied for the DotfuscatorXamarinConfigFileName property in your project file) in the same directory as your project file.
In Visual Studio, build your project once in a configuration you want to protect (e.g., AnyCPU|Release). It will error, because the new config file doesn't have any input assemblies yet, but by building now we get those assemblies in the right location for configuring Dotfuscator.
Open Dotfuscator's user interface.
For Community Edition, from Visual Studio, open the Tools menu and select PreEmptive Protection - Dotfuscator.
For Professional Edition, run Dotfuscator Professional Edition from the Start Menu.
In the user interface, File | Open the file created in step 1.
On the Inputs screen, click the "Add Input" button (a green plus-sign in Community Edition, a folder-opening icon in Professional Edition).
Browse to your project directory, then obj\Release\DotfuscatorXamarin\dfin, and then select the assemblies you want to protect.
Substitute Release with the appropriate directory for the configuration you built in step 2.
You should select assemblies that correspond to projects in your solution, and not select third-party and assemblies that are part of the framework.
Save the config file.
Navigate to the Project Properties editor.
In Community Edition, go to the Build Settings screen and select the Project Properties tab.
In Professional Edition, go to the Settings tab and select the Settings > Project Properties screen.
Add the following project properties (instructions for Community Edition, and for Professional Edition):
Property name InDir, value obj\Release\DotfuscatorXamarin\dfin
Property name OutDir, value obj\Release\DotfuscatorXamarin\dfout
Property name ReportDir, value DotfuscatorReports\Release
Substitute Release with the appropriate directory for the configuration you built in step 2. Note that the directories pointed to by OutDir and ReportDir won't exist on-disk yet.
Save the config file.
Return to the Inputs screen and select an input and click the pencil icon. Edit the path to the assembly from an absolute path to ${configdir}\${InDir}\AssemblyName.dll, substituting AssemblyName.dll for the actual name and extension of the assembly. Repeat for each input assembly.
Save the config file (and commit it to source control).
Rebuild the project in Visual Studio. The build integration will use your config file instead of trying to generate a new one.
on top of the Joe's marvelous solution I ended up changing one value from true to false with regards to the instructions on https://www.preemptive.com/dotfuscator/pro/userguide/en/getting_started_xamarin.html#pctoc-setup
to get my android solution to build/run.
<DotfuscatorXamarinGenerateNewConfigFile>false</DotfuscatorXamarinGenerateNewConfigFile>
I've been configuring the Dotfuscator Community Edition at Xamarin.Android project according to this user guide. And I also had the following build error (pretty the same as #AxiomaticNexus):
Error The "_DotfuscatorXamarin_DetermineDefaultInputsTask" task failed unexpectedly.
System.NullReferenceException: Object reference not set to an instance of an object.
at InlineCode._DotfuscatorXamarin_DetermineDefaultInputsTask.Execute() in c:\Users\user\AppData\Local\Temp\wqhfhbsk.0.cs:line 106
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() eKey.Droid C:\VSProjects\dotFuscatorTest\PreEmptive.Dotfuscator.Xamarin.targets 570
I've fixed this issue using #Joe Sewell's Full Disclosure.
I hope PreEmptive Solutions will realese the fixed version asap!!!
At some point I was missing the file PreEmptive.Dotfuscator.Xamarin.targets in the root of project. I already executed the instructions above described by Joe Sewell, but later noticed the missing file.
Error were like this:
Error The "_DotfuscatorXamarin_DetermineDefaultInputsTask" task failed unexpectedly.
System.NullReferenceException: Object reference not set to an instance of an object.
at InlineCode._DotfuscatorXamarin_DetermineD efaultInputsTask.Execute() in c:\Users\hieta\AppData\Local\Temp\k3a5f2bj.0.cs:line 106
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() WorkSafe.Droid
Just FYI if anyone else could avoid waste of time.

Cannot add a MVC controller VS2012 gives "object reference not set to an instance of an object"

I have searched extensively and cannot find another person on the planet with this problem...
The symptoms are:In Visual Studio 2012, on a MVC 4.0 Project that was upgraded from VS2010 and is configured for dual version editing from VS2012 and VS2010. When I right-click on the Controllers Folder and select Add->Controller... from the context menu, I get an "Object reference not set to an instance of an object" error from Visual Studio.
The existing code in the project runs fine, and if I use the Add->New Item option instead, and pick the Controller from the dialog box, then I can add a blank controller. I just cannot add a typed controller using the method above.
If I however create a new MVC4 Project, then I can add typed controllers again using the same menu, so the problem does not exist in Visual Studio's installation, it has to exist in the Project File. I have also checked the references between my project and a new MVC Project and all the new project references are included in my project.Has anyone experienced something similar?How do I fix this?
The issue seems to have been caused by an incomplete install/registration of the MvcScaffolder package.
The following process resolved my issue for me.
Start Visual Studio and open the project. Open the Package Manager Console. (This was the "trick" or missing piece of information that led to the solution...)
Here I saw the following error caused by the PowerShell script used for registration:
New-Object : Could not load file or assembly 'System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
At <ProjectPath...>\packages\MvcScaffolding.1.0.9\tools\registerWithMvcTooling.ps1:163 char:27
+ $newProvider = New-Object <<<< $powerShellScaffolderProviderType($mvcScaffoldingProvider)
+ CategoryInfo : NotSpecified: (:) [New-Object], FileNotFoundException
+ FullyQualifiedErrorId : System.IO.FileNotFoundException, Microsoft.PowerShell.Commands.NewObjectCommand
When I checked the registered scaffolders from the Package Manager Console I got:
PM> get-defaultscaffolder
DefaultName ScaffolderName
Action MvcScaffolding.Action
Controller MvcScaffolding.Controller
CustomScaffolder T4Scaffolding.CustomScaffolder
CustomTemplate T4Scaffolding.CustomTemplate
DbContext T4Scaffolding.EFDbContext
Mailer Mailer.Razor
Repository T4Scaffolding.EFRepository
UnitTest MvcScaffolding.ActionUnitTest
View MvcScaffolding.RazorView
Views MvcScaffolding.Views
So clearly the scaffolders are configured to use the MvcScaffolding package, but the package had a registration error.
A quick search for the error provided this link http://mvcscaffolding.codeplex.com/discussions/437692 which refers to https://visioautomation.codeplex.com/discussions/397034 that suggests installing PowerShell 3, which is actually part of the Windows Management Framework 3.0, available from http://www.microsoft.com/en-us/download/details.aspx?id=34595. I picked the Windows6.1-KB2506143-x64.msu file when prompted because I’m running Win 7-64-bit.
Restart the PC after installation, re-open Visual Studio and the project and look at the Package Manager Console. If the error is gone, then so is the controller problem.
I had this problem on VS2012 on Win8, We where working on a project that we started developing on VS2010 and i wasn't able to create new controllers with the CTRL+M, CTRL+C shortcut.
Opening any project and re-installing MvcScaffolder and its dependencies under Manage Nuget package have fixed this for me.
Didn't have to restart VS2012 at all.
Maybe your existing project have wrong ProjectTypeGuids element in .csproj file?
Right one for MVC4 is {E3E379DF-F4C6-4180-9B81-6769533ABE47}.
Try to compare what project type do you have in new project and in your existing project.
The preferred answer of installing the Windows Management Framework 3.0 did not work. The download "Windows6.1-KB2506143-x86.msu" did not work on my Windows 7 32 bit system. It failed with the error "The update is not applicable to your computer".
Reinstalling MVCscaffolding with Manage Nuget Packages did not work.
My ProjectType GUID was correct.
Microsoft Web Developer Tools was already installed.
Deleting and recreating the solution didn't work.
It was necessary to repair the Visual Studio 2012 installation from the install disk to fix this issue.
Installing "Microsoft Web Developer Tools" fixed this for me. Related:
How do I open a csproj with ProjectTypeGuids 349c5851-65df-11da-9384-00065b846f21?
{E3E379DF-F4C6-4180-9B81-6769533ABE47} - MVC4 Project
{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - CSharp Project
{349c5851-65df-11da-9384-00065b846f21} - Web Application Project (this is what you need web dev tools for)
The update Windows6.1-KB2506143-x64.msu worked for me. The problem started after a full SpyWare software scan. I think that it removes more things than the usual. So, back to normal life.
I had the same problem, im using database first, and it was because i have changed the .edmx contex.tt to generate the contex.cs with the connection name set to a custom method,
: base(sqlHelper.getMainConnectionString())
every time, before i change/update the .edmx, i need to change the connection name to it's creation defaults:
: base("name=YourWebconfigConnectionstringName")
rebuild the project and it works again
Answer:
Check your connectionstring string and provider parameters at the webconfig, then delete and recreate the .edmx this will force the generator to rebuild all the database objects, metadata included OR delete all tables in the designer, change the contex.cs to the default creation name, rebuild the project, add the tables, rebuild the project, it shoul work again.
This problem manifested on a target MVC5 project using VS2017.
Like the original op, a new project was attempted to perform an Add Controller with EF scaffolding against ApplicationUser. The error did initially manifest until a single user was registered forcing the database to be created. After that, add scaffolding worked without incident. I think this makes sense because the entity didn't really yet exist before the first registration, although I will stand corrected if someone more knowledgeable than myself has a more accurate explanation. But because Add Controller worked with a new project, just as the original op determined, it didn't seem to be a VS2017 installation problem. This pointed to something wrong with the taret project.
At this point in the target project an Undo All in Team Explorer was executed to get the project back to a previously working point. While this might be accomplished by getting a specific version, for this target project all that was required was an Undo All. A word of caution: in the case of this specific project, before undoing, the Package Manager was used to rollback the database to the starting point that would match with the Undo All. If one performs a get specific version, be sure to check if the database needs to get rolled back to the proper configuration. After resetting all the project changes, the object reference not set to an instance of an object error was no longer present during the Add Controller operation, fixing the error within the target project.
I post this response somewhat reluctantly because I am unable to duplicate the error, and I am unsure of what actually caused the problem in the first place, but this is a particularly nasty error if one is in the middle of a project and Add Controller starts failing. I figured if someone has this problem and rolling back the current change set might fix it for them, like me they will be thankful. If I later determine the pattern of activity that caused the problem to crop up in the first place, I'll surely add more to this post.
I'm running VS 2019 Enterprise, ASP.NET Core 3.1.3.
I was trying to add MVC controller with views using Entity Framework (EF) after scaffolding in database first approach.
I run on this issue because one of the tables in my ER model was missing primary key.
That table was connected to table for which I tried to generate MVC controller through another table that has primary key so I didn't noticed initially that error.

Getting Compilation Error when trying to do Multiple-Project ASP.Net MVC Site

I am getting this error.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1704: An assembly with the same simple name 'MyMVCAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null has already been imported. Try removing one of the references or sign them to enable side-by-side.
My solution has 2 ASP.Net MVC projects - splitting the main content and the areas. The main project doesn't have a reference to the 2nd one. Instead, it gets all MVC DLL's in the folder and stores it into the IOC container, which takes care of registering all the controllers.
I get the error when I set the output of my 2nd ASP.Net MVC project into the bin folder of the main one. (I've set all my views in the Areas solution to Copy Always.)
I also tried post-build action of copying the DLL into the main bin instead of setting the output, but the results are the same.
What should I do?
In addition, I have the following setup:
It is set to use the Local IIS Server instead of the VS Dev Server.
In the Output window, I see that the local web server is loading all the DLL's from the GAC and Temporary ASP.Net files folder. The problem I see is that it is also trying to load my DLL file from my Solutions folder.
Any ideas why it is trying to get that sole DLL from the Solution too? It doesn't have that behaviour for the other projects.
UPDATE:
Here's a strange behaviour:
[1] I clear all copies of the offending assembly.
[2] I removed the post-build action that copies that assembly to my main MVC project bin folder.
[3] I run the main project. It works without any issues, but of course the missing assembly does not get loaded.
[4] I manually copy that assembly to the mian MVC project bin folder.
[5] I run the solution. It is getting the error again!
Can someone explain why it is trying to load this very same assembly from two different places?
Ok this may be a clue to the problem: Because I am copying the assembly to the main MVC project's bin folder, it is also getting copied into the Temporary ASP.NEt folder. At the same time, because the project is not being referenced by any other project in the solution, it is also copying the same assembly into IIS. How can I prevent this from happening? If I exclude the step of copying the assembly into the main MVC bin, it does not get loaded into IIS at all. Why is it behaving that way?
This error points out that two references have the same assembly
identity because the assemblies in question lack strong names, they
were not signed, and thus the compiler has no way of distinguishing
between them in metadata. Thus, the run time ignores the version and
culture assembly name properties. The user should remove the redundant
reference, rename one of the references, or provide a strong name for
them.
Can explain that like below.
Below sample creates an assembly and saves it to the root directory.
// CS1704_a.cs
// compile with: /target:library /out:c:\\cs1704.dll
public class A {}
Below sample creates an assembly with the same name as the previous sample, but saves it to a different location.
// CS1704_b.cs
// compile with: /target:library /out:cs1704.dll
public class A {}
Below sample attempts to reference both assemblies.The following sample generates CS1704.
// CS1704_c.cs
// compile with: /target:library /r:A2=cs1704.dll /r:A1=c:\\cs1704.dll
// CS1704 expected
extern alias A1;
extern alias A2;
UPDATE
If both assemblies are strong-named (signed), the CLR will always load from the GAC.
You can follow below mentioned steps :
Determines the correct assembly version by examining applicable
configuration files, including the application configuration file,
publisher policy file, and machine configuration file. If the
configuration file is located on a remote machine, the runtime must
locate and download the application configuration file first.
Checks whether the assembly name has been bound to before and, if so,
uses the previously loaded assembly. If a previous request to load the
assembly failed, the request fails immediately without attempting to
load the assembly.
Checks the global assembly cache. If the assembly is found there, the
runtime uses this assembly.
Probes for the assembly (for more info check below mentioned article )
for more information check How the Runtime Locates Assemblies
I hope this will help to you.
I had a similar problem playing around with a test container project having added the wrong reference. I removed it and found that after a solution clean and a rebuild the issue was two DLL's in the bin directory clashing. Having removed them and rebuilt everything was fine.

Could not load file or assembly 'EntityFramework (1)'

Error is as follows:
C:\Users\[username]\Google Drive\VS2010\Projects\[project name]\[project name]\Views\Show\EditOrder.cshtml: ASP.NET runtime error: Could not load file or assembly 'EntityFramework (1)' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.
Hey all,
Got a strange problem here. seemingly randomly my project completely borked itself. A little bit of background: It's a ASP.Net MVC3 (.Net Framework 4) project that I mostly authored in Visual Web Developer 2010 Express. I say mostly because you'll note in the verbose error above I've stored it on my Google Drive. I'm syncing this project back and forth to my new development laptop, with an install of Visual Studio 2010 Professional. This probably isn't a great idea, but I wanted a simple method of working on it here on my desktop (at the office), at home (on my dev laptop), and on the road (again, dev laptop.)
Any ideas on what might have happened, and how I can fix this?
Bit more of background, now that I'm remembering this ... I had issues publishing it to our local IIS 6 server. I realized I had to add the _bin_deployableAssemblies to the package for it to work. At some point, I had deleted them from the project and re-added them. It was probably around that time, or at least within a few hours, that this issue started happening.
I can has halp?
Your MVC 3 project has a reference to one version of Entity Framework, but actually finds a different version when attempting to resolve the reference to Entity Framework on the computer where you get this error.
The simplest solution is probably to update to the current version of Entity Framework on your current computer, where you get the error.
If you open your project's .csproj file in a regular text editor (e.g. Notepad) you should see a line similar to this one:
<Reference Include="EntityFramework, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\EntityFramework.4.3.1\lib\net40\EntityFramework.dll</HintPath>
</Reference>
That will tell you the version your application is expecting to find. If you see
<SpecificVersion>False</SpecificVersion>
then the expected version or a later version can be used.
Another way to resolve this kind of loading issue is using the Fusion Log Viewer, which will show you binding attempts that fail and what the loader tried (make sure you run it as Administrator or it will silently just do nothing).
Bloody strange ..
Looking in my /[Project Name]/bin folder I found 4 strange files:
EntityFramework (1).dll
EntityFramework (1).xml
[Project Name] (1).dll
[Project Name] (1).pdb
In any case, after deleting them guys and doing a Rebuild, all is well!
(Anyone have any ideas as to how or why this happened? Might be a Google Drive issue, now that I'm thinking about it ...
It was a Google Drive issue for me. If you remove all files ending with (1) in your Project/bin folder it should resolve the problem.

Resources