Orchard 1.6 - Error building web site in Visual Studio 2012 - build

Using WebPI 4.0 I have installed and run successfuly Orchard 1.6, then for deploying purposes, I opened the web site in Visual studio 2012 and tried to build it but got the next:
1 error as next:
Object reference not set to an instance of an object.
C:\inetpub\wwwroot\Orchard\Modules\Contrib.Cache\Contrib.Cache.csproj
1
the error points to the first line: <?xml version="1.0" encoding="utf-8"?>
and some warnings as next:
The element 'PropertyGroup' in namespace
'http://schemas.microsoft.com/developer/msbuild/2003' has invalid
child element 'MvcBuildViews' in namespace
'http://schemas.microsoft.com/developer/msbuild/2003'. List of
possible elements expected: 'Property, AllowUnsafeBlocks,
AppConfigForCompiler, ...
the warnings point to the different lines in the same file above.
I could find nowhere a similar case, any idea please ?

I finally found that the WebPI downloads the already compiled version of Orchard CMS, so most of the source code is missing there, and it is wrong way to try to compile it again in Visual Studio.
The solution here is to cancel using the WebPI version and to download the source code version instead in a zip file from here:
http://orchard.codeplex.com/releases/view/90325#ReviewsAnchor

Related

Why doesn't the c++ file run in visual studio

So I tried making a basic game on the console using screen buffers, I was able to create it and make a square move in the canvas, but for my next project I looked up a website with the ASCII characters and pasted a couple into a comment at the end of the c++ file, when I ran the file visual studio prompted:
I clicked yes and it didn't run anymore.
Also I recently have installed an extension for visual studio (before it didn't run, the extension works fine but I don't know if the extension may have caused this as I didn't tried running it with the extension downloaded and applied), when I open visual studio and open a file it says:
The last record in the ActivityLog xml file, has a type of error and it's description is:
Microsoft.VisualStudio.Composition.CompositionFailedException: Expected 1 export(s) with contract name "Microsoft.VisualStudio.CppSvc.Internal.CodeAnalysis.ICodeAnalysisService" but found 0 after applying applicable constraints.
at Microsoft.VisualStudio.Composition.ExportProvider.GetExports(ImportDefinition importDefinition)
at Microsoft.VisualStudio.Composition.ExportProvider.GetExports[T,TMetadataView](String contractName, ImportCardinality cardinality)
at
Microsoft.VisualStudio.Composition.ExportProvider.GetExport[T,TMetadataView](String contractName)
at
Microsoft.VisualStudio.Composition.ExportProvider.GetExport[T](String contractName)
at
Microsoft.VisualStudio.Composition.ExportProvider.GetExportT
at
Microsoft.VisualStudio.Composition.ExportProvider.GetExportedValueT
at Microsoft.VisualStudio.ComponentModelHost.ComponentModel.GetServiceT
at Microsoft.VisualStudio.VC.ManagedInterop.<>c.<Initialize>b__52_15()
at
System.Lazy`1.CreateValue()
at
System.Lazy`1.LazyInitValue()
at
System.Lazy`1.get_Value()
at
Microsoft.VisualStudio.VC.CodeAnalysis.ResultTaggerProvider.CreateTagger[T](ITextBuffer buffer)
at
Microsoft.VisualStudio.Text.Tagging.Implementation.TagAggregator`1.GatherTaggers(ITextBuffer textBuffer)
--- End of stack trace from previous location where exception was thrown ---
at
Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
I have Visual Studio 2017
So why does running the file (with the local windows debugger button) say that there were build errors? And how can I fix it?
When it prompts the build error, and I click no it usually shows the errors but in this case it doesn't, yes will just run the last "successful" build (although I haven't changed the file since I have finished it before this error message started popping up)
Also there is no error in my code as I was able to run it before the build error kept appearing and I haven't touched the file since(only now to show the problems are)
Thanks for your time! if anything was unclear because of my English, comment and I'll try to clarify it
I fixed the error by deleting ComponentModelChache folder located at:
C:\Users\%userName%\AppData\Local\Microsoft\VisualStudio\15.0
15.0 is the version of your visual studio so it varies depending on the version you're using, %userName% is a replacement for the user you're logged in as

Why does Visual Studio 2017 fail to generate REST API client for Swagger Petstore?

I'm playing around with using Swagger / OpenAPI docs/specs to generate REST API client code in C#, but I'm running into several problems.
Most notably - when trying to use the Swagger.io Petstore example as a starting point:
Using the VS 2017 Add > REST API client option in VS 2017, I don't get any code produced - instead an error is shown:
Generating client code and adding to project started
Generate client code for REST API with following parameters:
REST API Name: OpenApiClientClient, Base namespace: OpenApiClient, Metadata file path: C:\Users\Marc\AppData\Local\Temp\WebToolsAutoRest\OpenApiClientClient\201807162213351660\swagger.json
[Info]AutoRest Core 0.16.0.0
[Info]Initializing modeler.
[Info]Initializing modeler.
[Info]Parsing swagger json file.
[Info]Generating client model from swagger model.
[Fatal]Error generating client model: Collection format "multi" is not supported (in parameter 'status').
Exception: There was an error during code generation when trying to add a client for the REST API
Generating client code and adding to project failed
Adding REST API client for failed
So if the Swagger sample app isn't compatible - how will others be?? (and I tried a few others, all with the same results, unfortunately).
What's wrong here? Am I missing something, do I need to add some extra tooling to VS 2017 to make this work?
UPDATE:
OK, so I now tried to install Autorest using npm directly:
npm install -g autorest
This appears to work - no errors shown or anything.
But trying to run Autorest - with a set of command line parameters, or even just on its own - results in an error:
AutoRest -CodeGenerator CSharp -Modeler Swagger
-Input https://petstore.swagger.io/v2/swagger.json
-Namespace Services.UserServiceClient -OutputDirectory d:\projects
-AddCrendentials true
or just
AutoRest <kbd>Enter</kbd>
results in:
AutoRest code generation utility [version: 2.0.4280; node: v9.9.0]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
Failure:
Error: Unable to start AutoRest Core from C:\Users\Marc.autorest\#microsoft.azure_autorest-core#2.0.4280\node_modules\#microsoft.azure\autorest-core
Error: Unable to start AutoRest Core from C:\Users\Marc.autorest\#microsoft.azure_autorest-core#2.0.4280\node_modules\#microsoft.azure\autorest-core
at main (C:\Users\Marc\AppData\Roaming\npm\node_modules\autorest \dist\app.js:232:19)
at
Any further ideas?
Visual Studio 2017 is using a very old version of AutoRest. The issue you are seeing is this one which was fixed in AutoRest v. 1.0. As explained in the comments in that issue:
Are you referring to the autorest version that's built-into visual studio? -- That's incredibly old, and we didn't update that (we've changed the whole way autorest works).
You are going to need to install node and use autorest from the command line.
Looks like it's not possible to update AutoRest used by Visual Studio 2017, so you'll need to call AutoRest directly.
I also had this problem so I built a tool for it called REST API Client Code Generator. I worked in teams where we used tools like AutoRest, NSwag, and Swagger Codegen to generate our REST API Clients and it always annoyed me that the "Add New - REST API Client..." tooling in Visual Studio didn't always work and was very troublesome when it was time to re-generate the client
This would add the OpenAPI specification file (Swagger.json) to the project and set a custom tool so that every time changes are made to it the REST API Client code is re-generated. You can also right click on the Swagger.json file and switch code generators
I built the tool mainly for personal use and for use within my teams but if you find it useful and think it lacks something you really need then please reach out
Try running autorest --reset. This worked on windows with node v8.12.0. Prior to running that command I was getting the same error.

TFS 2017 Build Fails - can't publish test results

TFS 2017 Build is failing on the Visual Studio Test task when it tries to publish tests result. Using task version 2.* ... version 1.* was not working anymore (couldn't find path vstest.console.exe and acted strange when I put specific path)... how can I get this to work? using tfs 2017.5 on the build server, and TFS Version 15.117.26714.0, using the latest agent from that.
2017-09-21T20:29:13.5158841Z Results File: D:\agent1_work\1\s\Dev\20170305_MD_4.4\TestResults\TfsService_DEVBUILD5 2017-09-21 15_14_33.trx
2017-09-21T20:29:14.5470386Z ##[warning]Vstest failed with error. Check logs for failures. There might be failed tests.
2017-09-21T20:29:14.5470386Z ##[error]Error: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe failed with return code: 1
2017-09-21T20:29:17.9532729Z ##[warning]Failed to publish test results: '', hexadecimal value 0x10, is an invalid character. Line 10256, position 10.
2017-09-21T20:29:17.9532729Z ##[error]Vstest exited with return code: 1.
OK found an answer, have to use a newer version of vstest.console.exe provided by the TFS tasks team. see last item here:
https://github.com/Microsoft/vstest/issues/683
basically, need pass custom vstest.console.exe path which is VS-Insallation-Directory\Common7\IDE\Extensions\TestPlatform\vstest.console.exe in your vstest V2 task.

MSB4018 The "ResolveComReference" task failed unexpectedly

I am currently trying to upgrade our c++ mfc solution from visual studio 2010 to a visual studio 2013 solution. When i try to build it i get the error MSB4018 The "ResolveComReference" task failed unexpectedly. I enabled fusion logging and this is what it tells me:
=== Pre-bind state information ===
LOG: DisplayName = System
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: System | Domain ID: 1
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Program Files (x86)/MSBuild/12.0/bin/
LOG: Initial PrivatePath = NULL
Calling assembly : Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. ===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files (x86)\MSBuild\12.0\bin\MSBuild.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/12.0/bin/System.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/12.0/bin/System/System.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/12.0/bin/System.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/12.0/bin/System/System.EXE.
I understand that msbuild has been moved, but i dont understand why it is trying to find System.dll in the msbuild path, how can i make it look for it in its proper location?
Edit:
I have now also tried upgrading to visual studio 2012 which worked without bigger problems and I did not run into the same problem. However i noticed that when running devenv /upgrade (with vs2013) it seems to completely change everything under vc++ directories (it stayed unchanged when upgrading to vs2012). Could this have something to do with this issue?
Edit2:
Tried to build the project in vs2013 after upgrading it to 2012 (without running devenv /upgrade), this also didnt work so I guess the problem is not related to that...
After enabling diagonostic build output i found that it was 3 broken COM references in the project that where failing to load. Removing these references solved the building issue. These where only showing up as warnings in vs2010 but resulted in MSB4018 in vs 2013 for some reason.
This is your problem:
LOG: Appbase = file:///C:/Program Files (x86)/MSBuild/12.0/bin/
Fix the base folder in your build system if you really need it to point to another filder. However it would probably be better to redo you build system targeting 2013 instead of patching the 2010 version.

svcutil failing on IIS7 server, but not on Visual Studio 2010 temporary web server

I've created a LINQ to SQL class and a Silverlight-enabled WCF Service to a Silverlight 4.0 solution I'm working on. I'm in the process of publishing it to a local IIS7 server, instead of running inside the Visual Studio temporary web server. Whenever I build the project with the service running on the temporary web server, it works fine, but once I move it to my IIS7 web server, it fails with the following errors:
Warning 1 Custom tool warning: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error: Schema with target namespace '' could not be found.
XPath to Error Source: //wsdl:definitions[#targetNamespace='']/wsdl:portType[#name='SpaceGameDBService'] C:\Users\MindWorX\documents\visual studio 2010\Projects\MindWorX.Spacegame\MindWorX.Spacegame\Service References\DBServiceReference\Reference.svcmap 1 1 MindWorX.Spacegame
Warning 2 Custom tool warning: Cannot import wsdl:binding
Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on.
XPath to wsdl:portType: //wsdl:definitions[#targetNamespace='']/wsdl:portType[#name='SpaceGameDBService']
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://tempuri.org/']/wsdl:binding[#name='CustomBinding_SpaceGameDBService'] C:\Users\MindWorX\documents\visual studio 2010\Projects\MindWorX.Spacegame\MindWorX.Spacegame\Service References\DBServiceReference\Reference.svcmap 1 1 MindWorX.Spacegame
Warning 3 Custom tool warning: Cannot import wsdl:port
Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on.
XPath to wsdl:binding: //wsdl:definitions[#targetNamespace='http://tempuri.org/']/wsdl:binding[#name='CustomBinding_SpaceGameDBService']
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://tempuri.org/']/wsdl:service[#name='SpaceGameDBService']/wsdl:port[#name='CustomBinding_SpaceGameDBService'] C:\Users\MindWorX\documents\visual studio 2010\Projects\MindWorX.Spacegame\MindWorX.Spacegame\Service References\DBServiceReference\Reference.svcmap 1 1 MindWorX.Spacegame
Warning 4 Custom tool warning: No endpoints compatible with Silverlight 4 were found. The generated client class will not be usable unless endpoint information is provided via the constructor. C:\Users\MindWorX\documents\visual studio 2010\Projects\MindWorX.Spacegame\MindWorX.Spacegame\Service References\DBServiceReference\Reference.svcmap 1 1 MindWorX.Spacegame
Warning 5 Custom tool warning: Exception has been thrown by the target of an invocation. C:\Users\MindWorX\documents\visual studio 2010\Projects\MindWorX.Spacegame\MindWorX.Spacegame\Service References\DBServiceReference\Reference.svcmap 1 1 MindWorX.Spacegame
Error 6 Custom tool error: Failed to generate code for the service reference 'DBServiceReference'. Please check other error and warning messages for details. C:\Users\MindWorX\documents\visual studio 2010\Projects\MindWorX.Spacegame\MindWorX.Spacegame\Service References\DBServiceReference\Reference.svcmap 1 1 MindWorX.Spacegame
Now, I believe that warning 4 and 5 and error 6 is a result of warning 1, 2 and 3, so I've ignored them for now. I've been googling around, and seen suggestions telling me to untick the checkbox "Reuse types in referenced assemblies" when I add the service reference to the main Silverlight project, however this hasn't fixed my issue at all. I've tried restarting Visual Studio as well, but this hasn't fixed anything either. I've started to consider that it's some sort of setting in the IIS7 web server, that I'm missing, but I looked around for hours now, and decided to come here for help. I found a similar problem here, but the "solution" was to not solve the problem, but instead find another way. I'm hoping this time we can find a solution instead.
Turns out that when I created the solution, I forgot to tick "Enable WCF RIA Services". Along with this I also redid web.config from scratch. How this still works on the development server is a mystery to me, however doing both things solved the problem.