When merged develop branch to master branch it could happen that the project file contains repeating items. As result, compiling your visual studio project will have such compile error like:
The item "xxx" was specified more than once in the "Resources" parameter. Duplicate items are not supported by the "Resources" parameter.
The solution is easy:
1. Right click on your project and select "Unload the project"
2. Right click on your project and select "Edit YourProject.csproj"
3. Locate the repeating items and remove them.
4. Reload the project
Then these compile error will be resolved.
Showing posts with label Visual Studio. Show all posts
Showing posts with label Visual Studio. Show all posts
Tuesday, April 23, 2019
Resolve issues while openning old project in Visual Studio 2015/2017
When you opened your old project in Visual studio 2015/2017, you will find a lot of missing packages. When you tried to install any one of those missing packages, the visual studio will warn you that the soltuion is not saved.
How to resolve this?
My easy solution is:
1. Under File, choose save your solution.
2. Open Tools, Nuget Package Manager, Package Manger Console, and enter following command:
Update-Package –reinstall Microsoft.AspNet.Web.Optimization
Note Microsoft.AspNet.Web.Optimization can be any one of your missing package, then all missing package will be reinstalled automatically.
Reference:
https://developercommunity.visualstudio.com/content/problem/40958/update-package-reinstall-forces-all-packages-to-re.html
How to resolve this?
My easy solution is:
1. Under File, choose save your solution.
2. Open Tools, Nuget Package Manager, Package Manger Console, and enter following command:
Update-Package –reinstall Microsoft.AspNet.Web.Optimization
Note Microsoft.AspNet.Web.Optimization can be any one of your missing package, then all missing package will be reinstalled automatically.
Reference:
https://developercommunity.visualstudio.com/content/problem/40958/update-package-reinstall-forces-all-packages-to-re.html
Tuesday, May 22, 2018
Process with an ID #### is not running on Visual Studio 2015
When I installed both Visual Studio 2013 and 2015 on my computer, and use 2013 to open my visual studio web project and doing my test/run at first without problem, and then use 2015 to open the same project and choose to debug, there is error "Process with an ID #### is not running" on Visual Studio 2015. I google the issue and there is following solution:
https://www.ryadel.com/en/process-id-not-running-visual-studio-2015-fix/
- Delete the \Documents\IISExpress folder using the following console command:
rmdir /s /q "%userprofile%\Documents\IISExpress" - Delete the applicationhost.config file which is placed within the \.vs\Config\ folder in your Visual Studio project root folder.
https://www.ryadel.com/en/process-id-not-running-visual-studio-2015-fix/
Friday, December 4, 2015
How to Change Your Visual Studio Web Application From SSL Enabled to SSL Disabled
You can easily change your visual Studio web application to use SSL through Project Properties window.
After that, your project's web properties will be changed to use the https link:

So by default, your project will be launched with SSL protocol on your local machine.
However, if you want to change back not to use SSL in your local, you may experience following issue after you change project properties window from SSL Enabled True to SSL Enabled False:
After that, your project's web properties will be changed to use the https link:
So by default, your project will be launched with SSL protocol on your local machine.
However, if you want to change back not to use SSL in your local, you may experience following issue after you change project properties window from SSL Enabled True to SSL Enabled False:
It said, "You can't remove SSL from this site because this Web project is currently configured to browse with this URL. You need to use the Web property page to change the project URL to the non-secure URL first."
It happened because your project's web properties still has https link. You need to change it to use http link and then you can change from SSL Enabled True to SSL Enabled False.
But how to make it?
When you launch web application through Visual Studio, the IIS Express will be launched as well. Under your twindows task bar, there is IIS Express Icon.
Right click on the Icon, and you will see 2 http links with one https and one http. Copy that http link to your Project's Web Properties configuration for "Project Url link". Then you can change from SSL Enabled True to SSL Enabled False.
Monday, November 2, 2015
How to remove Source Control Binding from Visual Studio Project
If your project has been binding with TFS before, and you want to open the project locally, you will get following annoying information: The team foundation server http://some-tfs-server/ is currently not available, The solution will be opened locally. To remove the annoying information, deleted the .suo next to the .sln file, and then opened the .sln file in Notepad and deleted this entire section:
This should remove all bindings from the solution and project files. (After this you can switch the SCC provider in Tools -> Options -> Source Control -> Plug-in Selection).
The SCC specification prescribes that all SCC providers should implement this behavior including VSS, TFS, etc.
Source:
http://stackoverflow.com/questions/358951/how-can-i-completely-remove-tfs-bindings
GlobalSection(TeamFoundationVersionControl) = preSolution
SccNumberOfProjects = 2
SccEnterpriseProvider = {xxxxx}
SccTeamFoundationServer = http://some-tfs-server/
SccLocalPath0 = .
SccProjectUniqueName1 = xxDemo\\xxDemo.csproj
SccProjectName1 = xxDemo
SccLocalPath1 = xxDemo
EndGlobalSection
If you can connect to the TFS, you just want to simply unload the project from the source control server, go to File -> Source Control -> Change Source Control and then unbind and/or disconnect all projects and the solution.This should remove all bindings from the solution and project files. (After this you can switch the SCC provider in Tools -> Options -> Source Control -> Plug-in Selection).
The SCC specification prescribes that all SCC providers should implement this behavior including VSS, TFS, etc.
Source:
http://stackoverflow.com/questions/358951/how-can-i-completely-remove-tfs-bindings
Thursday, October 15, 2015
Applying MVC 5 on Visual Studio 2012 Express
Visual Studio 2013 has been shipped with MVC 5 along with .Net 4.5.1 2 years ago. It even included a free communication version with full functionality. Since then, it has evolved with 5 updated versions until July 2015.
Visual Studio 2013 combines Nuget 2.7, ASP.Net MVC 5, ASP.Net Web API 2, Entity Framework 6, ASP.Net Razor, ASP.Net Scaffolding, a new code generating framework for ASP.Net web applications, and Bootstrap 3, a layout and theme framework from twitter to provide responsive design through CSS 3, etc. Such new features are exciting for all ASP.Net web developers. However, for Microsoft Database or BI developers, if they are stick to SQL Server 2012, they would better to keep their old Visual Studio 2012 as the support for BI development such as SSAS/SSRS/SSIS 2012 on Visual Studio 2013 are not perfect.
Fortunately, Microsoft announced MVC 5 for visual studio 2012. Also, Visual Studio 2012 Update 4 and ASP.Net and Web Tools 2013.1 for Visual Studio 2012 would be also required, especially for Visual Studio 2012 Express for Web.
After you installed the web tools 2013.1 for Visual Studio 2012, your Visual Studio 2012 for Web would show following new ASP.Net web templates:
Note you still can't find a fully functional ASP.Net MVC 5 Web Application template, except an empty one.
You can create a new project using ASP.Net MVC 5 Empty Project, and then right click on the project, click Add.. > New Scaffolded Item..., select MVC on the left, then MVC 5 Dependencies and choose Full dependencies from the prompt.
This will add a default layout Views\Shared\_Layout.cshtml, Content folder, Scripts folder with bootsrap, jquery, modernizer, etc, and other things the Web Application template will create.
You could get the error "CS0103: The name 'Styles' doesnot exist in the current context", just add <namespace="System.Web.Optimization"/> under <namespaces> in Views/web.config.
To add a fully functional ASP.Net MVC 5 Web Application template, download the MVC 5 template from here. Copy the file into the following folder of your PC:
%USERPROFILE%\Documents\Visual Studio 2012\Templates\ProjectTemplates\Visual C#\Web
and then change DefaultConnection in Web.config with following format:
If during the debug, you get the error "CS0234: The type or namespace name 'Ajax' does not exist in the namespace 'System.Web.Mvc' (are you missing an assembly reference?)", simply open the reference directory of your project under solution explorer, right click on the package name, choose the property, and change the Copy Local to true.
Note after you created your MVC 5 application, if you open your web.config file, you could find following issue:
It was said "The entityframework element has invalid child element providers.". This could give warning message for your project. To resolve this warning, you need to copy following 2 files:
to folder: "C:\Program Files\Microsoft Visual Studio 11.0\Xml\Schemas":
1. EntityFrameworkCatalog.xml
Source:
http://www.asp.net/visual-studio/overview/2013/release-notes
http://stackoverflow.com/questions/19102831/how-to-install-asp-net-mvc-5-in-visual-studio-2012
http://stackoverflow.com/questions/18288215/how-can-i-add-the-mvc-5-project-template-to-vs-2012
http://stackoverflow.com/questions/20607648/no-asp-net-mvc-5-web-application-template-on-vs-2012
http://stackoverflow.com/questions/20068833/the-element-entityframework-has-invalid-child-element-entity-framework
Visual Studio 2013 combines Nuget 2.7, ASP.Net MVC 5, ASP.Net Web API 2, Entity Framework 6, ASP.Net Razor, ASP.Net Scaffolding, a new code generating framework for ASP.Net web applications, and Bootstrap 3, a layout and theme framework from twitter to provide responsive design through CSS 3, etc. Such new features are exciting for all ASP.Net web developers. However, for Microsoft Database or BI developers, if they are stick to SQL Server 2012, they would better to keep their old Visual Studio 2012 as the support for BI development such as SSAS/SSRS/SSIS 2012 on Visual Studio 2013 are not perfect.
Fortunately, Microsoft announced MVC 5 for visual studio 2012. Also, Visual Studio 2012 Update 4 and ASP.Net and Web Tools 2013.1 for Visual Studio 2012 would be also required, especially for Visual Studio 2012 Express for Web.
After you installed the web tools 2013.1 for Visual Studio 2012, your Visual Studio 2012 for Web would show following new ASP.Net web templates:
Note you still can't find a fully functional ASP.Net MVC 5 Web Application template, except an empty one.
You can create a new project using ASP.Net MVC 5 Empty Project, and then right click on the project, click Add.. > New Scaffolded Item..., select MVC on the left, then MVC 5 Dependencies and choose Full dependencies from the prompt.
This will add a default layout Views\Shared\_Layout.cshtml, Content folder, Scripts folder with bootsrap, jquery, modernizer, etc, and other things the Web Application template will create.
You could get the error "CS0103: The name 'Styles' doesnot exist in the current context", just add <namespace="System.Web.Optimization"/> under <namespaces> in Views/web.config.
To add a fully functional ASP.Net MVC 5 Web Application template, download the MVC 5 template from here. Copy the file into the following folder of your PC:
%USERPROFILE%\Documents\Visual Studio 2012\Templates\ProjectTemplates\Visual C#\Web
and then change DefaultConnection in Web.config with following format:
<connectionStrings>
<add name="MyDBConnection" connectionString="Data Source=localhost;Initial Catalog=MyDB;
Persist Security Info=True;User ID=MyName;Password=MyPassword"
providerName="System.Data.SqlClient"/>
</connectionStrings>
Now you can restart you Visual Studio 2012 express for Web and enjoy the new MVC 5 template.If during the debug, you get the error "CS0234: The type or namespace name 'Ajax' does not exist in the namespace 'System.Web.Mvc' (are you missing an assembly reference?)", simply open the reference directory of your project under solution explorer, right click on the package name, choose the property, and change the Copy Local to true.
Note after you created your MVC 5 application, if you open your web.config file, you could find following issue:
It was said "The entityframework element has invalid child element providers.". This could give warning message for your project. To resolve this warning, you need to copy following 2 files:
to folder: "C:\Program Files\Microsoft Visual Studio 11.0\Xml\Schemas":
1. EntityFrameworkCatalog.xml
<?xml version="1.0" encoding="utf-8"?> <SchemaCatalog xmlns="http://schemas.microsoft.com/xsd/catalog"> <Association extension="config" schema="%InstallRoot%/xml/schemas/EntityFrameworkConfig_6_1_4.xsd" /> </SchemaCatalog>2. EntityFrameworkConfig_6_1_4.xsd
<?xml version="1.0" encoding="utf-8"?> <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="entityFramework"> <xs:complexType> <xs:all> <xs:element name="defaultConnectionFactory" type="ElementWithTypeAndParameters_Type" minOccurs="0" maxOccurs="1" /> <xs:element name="providers" type="ProviderList_Type" minOccurs="0" maxOccurs="1" /> <xs:element name="contexts" type="ContextList_Type" minOccurs="0" maxOccurs="1" /> <xs:element name="interceptors" type="InterceptorList_Type" minOccurs="0" maxOccurs="1" /> </xs:all> <xs:attribute name="codeConfigurationType" type="NonEmptyString_Type" use="optional" /> <xs:anyAttribute namespace="http://schemas.microsoft.com/XML-Document-Transform" processContents="strict"/> </xs:complexType> </xs:element> <xs:complexType name="ProviderList_Type"> <xs:sequence> <xs:element name="provider" type="Provider_Type" minOccurs="0" maxOccurs="unbounded" /> </xs:sequence> <xs:anyAttribute namespace="http://schemas.microsoft.com/XML-Document-Transform" processContents="strict"/> </xs:complexType> <xs:complexType name="Provider_Type"> <xs:attribute name="invariantName" type="NonEmptyString_Type" use="required" /> <xs:attribute name="type" type="NonEmptyString_Type" use="required" /> <xs:anyAttribute namespace="http://schemas.microsoft.com/XML-Document-Transform" processContents="strict"/> </xs:complexType> <xs:complexType name="ContextList_Type"> <xs:sequence> <xs:element name="context" type="Context_Type" minOccurs="0" maxOccurs="unbounded" /> </xs:sequence> <xs:anyAttribute namespace="http://schemas.microsoft.com/XML-Document-Transform" processContents="strict"/> </xs:complexType> <xs:complexType name="Context_Type"> <xs:choice> <xs:element name="databaseInitializer" type="ElementWithTypeAndParameters_Type" minOccurs="0" maxOccurs="1" /> </xs:choice> <xs:attribute name="type" type="NonEmptyString_Type" use="required" /> <xs:attribute name="disableDatabaseInitialization" type="SmallBoolean_Type" use="optional" /> <xs:attribute name="commandTimeout" type="xs:int" use="optional" /> <xs:anyAttribute namespace="http://schemas.microsoft.com/XML-Document-Transform" processContents="strict"/> </xs:complexType> <xs:complexType name="InterceptorList_Type"> <xs:sequence> <xs:element name="interceptor" type="ElementWithTypeAndParameters_Type" minOccurs="0" maxOccurs="unbounded" /> </xs:sequence> <xs:anyAttribute namespace="http://schemas.microsoft.com/XML-Document-Transform" processContents="strict"/> </xs:complexType> <xs:complexType name="ElementWithTypeAndParameters_Type"> <xs:choice> <xs:element name="parameters" type="ParameterList_Type" minOccurs="0" maxOccurs="1" /> </xs:choice> <xs:attribute name="type" type="NonEmptyString_Type" use="required" /> <xs:anyAttribute namespace="http://schemas.microsoft.com/XML-Document-Transform" processContents="strict"/> </xs:complexType> <xs:complexType name="ParameterList_Type"> <xs:sequence> <xs:element name="parameter" type="Parameter_Type" minOccurs="0" maxOccurs="unbounded" /> </xs:sequence> <xs:anyAttribute namespace="http://schemas.microsoft.com/XML-Document-Transform" processContents="strict"/> </xs:complexType> <xs:complexType name="Parameter_Type"> <xs:attribute name="value" type="NonEmptyString_Type" use="required" /> <xs:attribute name="type" type="NonEmptyString_Type" use="optional" /> <xs:anyAttribute namespace="http://schemas.microsoft.com/XML-Document-Transform" processContents="strict"/> </xs:complexType> <xs:simpleType name="SmallBoolean_Type"> <xs:restriction base="xs:NMTOKEN"> <xs:enumeration value="false" /> <xs:enumeration value="true" /> </xs:restriction> </xs:simpleType> <xs:simpleType name="NonEmptyString_Type"> <xs:restriction base="xs:string"> <xs:minLength value="1" /> </xs:restriction> </xs:simpleType> </xs:schema>These 2 files can be found at this link:
Source:
http://www.asp.net/visual-studio/overview/2013/release-notes
http://stackoverflow.com/questions/19102831/how-to-install-asp-net-mvc-5-in-visual-studio-2012
http://stackoverflow.com/questions/18288215/how-can-i-add-the-mvc-5-project-template-to-vs-2012
http://stackoverflow.com/questions/20607648/no-asp-net-mvc-5-web-application-template-on-vs-2012
http://stackoverflow.com/questions/20068833/the-element-entityframework-has-invalid-child-element-entity-framework
Subscribe to:
Posts (Atom)

