zend studio auto add namespace not working - zend-studio

i used
The Zend Studio 10.6
,then upgrade it to
12.5
Now when i add new class it does not add namespace class in top of my code
for example:
$test = new test();
i must add
use project\Model\test;
in top of my code manually, but it must add this line automatically.
i active code assistant but problem not solved.
sincerely

It is a bug,reported in zend studio forum
http://forums.zend.com/viewtopic.php?f=59&t=126628

Related

Is there a Preprocessed Razor Template for Visual Studio 2015

I am going thru this article here which talks about using the Razor template for Xamarin forms. I am however unable to find such a template in Visual Studio. The closest I came to was a nuget package. I don't think I can use that if I am to follow the example in the article above. Has anyone found any such problem before or can this only be done on Xamarin studio?
Why would they not make a provision for Visual Studio as well!
Just tried to use a razor template inside a Xamarin.Forms PCL and stumbled over the missing template. But then I followed the advice in the comments and it worked without any problems.
Add a new class (or whatever you want) to the portable project and name the file RazorTest.cshtml.
Replace the content of the new file with a skeleton like this:
Adjust the namespace and bind to your own ViewModel:
#using RazorTestNamespace.ViewModels
#model RazorTestViewModel
<html>
<body>
<h1>#Model.Title</h1>
</body>
</html>
Go to the class properties, find the CustomTool property and type in RazorTemplatePreprocessor. Then VisualStudio magically creates the belonging RazorTest.cs file with the code-behind.
Build the HTML when needed:
Inside the ViewModel:
RazorTest razorTest = new RazorTest { Model = razorTestViewModel };
string html = razorTest.GenerateString();

visual studio 2010 inserts using directives inside namespace

I have exactly opposite problem to one described here. In my case Visual Studio inserts using directives inside namespace and I want to prevent this. I did try to uncheck Resharper option:
Languages -> C# -> Formatting Style -> Namespace Imports -> Add using directive to the deepest scope
And it didn't help. Also I tried to temporary disable the Resharper. Still same issue.
Btw, I have StyleCop and StyleCop+ installed as well. Maybe it is causing the issue.
So right now when I go and Add New Item -> Class - it will create new code file with using directives inside namespace. How to change this?
Have you replace your class template file with one that has one or more using directives inside the namespace declaration? If so, you're probably seeing the result of an interesting bit of C# plugin behavior: a newly added using directive is placed after the last recognized using directly already in the file, regardless of where that is.

What happened to HttpConfiguration.EnableSystemDiagnosticsTracing

I am using the new WebTools 2012.2, and the help files says to add config.EnableSystemDiagnosticsTracing to your Global.asax.
However, this method doesnt exist on HttpConfiguration.
The EnableSystemDiagnosticsTracing extension is part of the Tracing package. Do you have the Microsoft.AspNet.WebApi.Tracing package installed?
Also make sure to have the using System.Web.Http; namespace.
Documentation: link
To install use:
Install-Package Microsoft.AspNet.WebApi.Tracing
Update-Package Microsoft.AspNet.WebApi.WebHost
After that check the following in your project:
Add dll-file \packages\Microsoft.AspNet.WebApi.Tracing.5.2.2\lib\net45\System.Web.Http.Tracing.dll to your project.
Add the following to WebApiConfig.cs
using System.Web.Http;
using System.Web.Http.Tracing;
And
//tracing
config.EnableSystemDiagnosticsTracing();
Because it is an extension method, you need a using statement where the extension method is declared. So in your Global.asax.cs or whereever you want to call EnableSystemDiagnosticsTracing(), you need to add this at the top:
using System.Web.Http;
Shouldn't it trace by default to the Output window for projects created using WebAPI template, if you have Visual Studio 2012 ASP.NET and Web Tools 2012.2? EnableSystemDiagnosticsTracing does the same.

Does Visual Web Part support ObjectDataSource in designer?

I'm trying to upgrade some Sharepoint 2007 webparts to SP2010 using the web part projects built into Visual Studio 2010. Namely, I'm using Visual Web Part to migrate our existing controls, which make extensive use of ObjectDataSource. However, when adding an ODS to the control in the Visual Web Part project, it will not pick up objects in referenced class library projects. I was able to duplicate the problem from a clean setup as follows:
Create a new Visual Web Part
Add a new class library to the solution.
Class code is as follows:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WebPartODS
{
[System.ComponentModel.DataObject(true)]
public class TestUser
{
[System.ComponentModel.DataObjectMethod(System.ComponentModel.DataObjectMethodType.Select,false)]
public List<int> TestMethod()
{
return new List<int>();
}
}
}
Add the class library project as a reference in the Web Part project
In the VisualWebPart ascx file, add a objectdatasource in the Source view:
<asp:ObjectDataSource ID="TestOD" runat="server"></asp:ObjectDataSource>
Switch to Design view, bring up the "Configure data source" wizard. On the drop down, the class from the library project will not appear.
Is there a step that I am missing here, or is there an issue with trying to do it this way?
Ok, i got it to work. Here is where i got my answer: MSDN Forumn
I originally had a separate class for my business layer. I removed it and put my code in the ascx.cs file. Then I added the following line of code to my page load method.
ObjectDataSource1.TypeName = this.GetType().AssemblyQualifiedName;
I also removed the TypeName from the ascx page.

d:DesignData issue, Visual Studio 2010 cant build after adding sample design data with Expression Blend 4

VS 2010 solution and Silverlight project builds fine, then:
I open MyView.xaml view in Expression Blend 4
Add sample data from class (I use my class defined in the same project)
after I add new sample design data with Expression blend 4, everything looks fine, you see the added sample data in the EB 4 fine, you also see the data in VS 2010 designer too.
Close the EB 4, and next VS 2010 build is giving me this errors:
Error 7 XAML Namespace http://schemas.microsoft.com/expression/blend/2008 is not resolved. C:\Code\source\...myview.xaml
and:
Error 12 Object reference not set to an instance of an object. ... TestSampleData.xaml
when I open the TestSampleData.xaml I see that namespace for my class used to define sample data is not recognized.
However this namespace and the class itself exist in the same project!
If I remove the design data from the MyView.xaml:
d:DataContext="{d:DesignData /SampleData/TestSampleData.xaml}"
it builds fine and the namespace in TestSampleData.xaml is recognized this time??
and then if add:
d:DataContext="{d:DesignData /SampleData/TestSampleData.xaml}"
I again see in the VS 2010 designer sample data, but the next build fails and again I see studio cant find the namespace in my TestSampleData.xaml containing sample data.
That cycle is driving me crazy. Am I missing something here, is it not possible to have your class defining sample design data in the same project you have the MyView.xaml view??
cheers
Valko
I know this is and old question, but do you have the line mc:Ignorable="d" in your xaml? Without this line you will get this error.
Add this namespace
xmlns:SampleData="clr-namespace:Expression.Blend.SampleData.TestSampleData"
Add this resource to a resource dictionary
<SampleData:TestSampleData x:Key="TestSampleData" d:IsDataSource="True"/>
Reference like this in your xaml
d:DataContext="{Binding Source={StaticResource TestSampleData}}"
I realise this is an old(ish) question but I hope this helps someone.

Resources