Visual Studio 2010 - Change exe file names on dependent projects - visual-studio-2010

I have two projects in VS2010. First one is a GUI that depends on second one that has DLLs.
I did a mistake in not naming them properly.
Now I want to change the name of both, I could change the name/dll name on second project by changing the assembly. But when I change assembly on first one, it doesn't work. Compilation fails. How do I change the exe name/original file name for both?
ActionLog is my first project for GUI, I am trying to rename it to ActionLog1. Just for test now. GUI defined with xml.
------ Build started: Project: ActionLog, Configuration: Debug x86 ------
C:\Users\admin\Proj\project-7440\ActionLog\MainWindow.xaml.cs(24,13): error CS0103: The name 'InitializeComponent' does not exist in the current context
C:\Users\admin\Proj\project-7440\ActionLog\MainWindow.xaml.cs(26,18): error CS1061: 'ActionLog.MainWindow' does not contain a definition for 'SearchBox' and no extension method 'SearchBox' accepting a first argument of type 'ActionLog.MainWindow' could be found (are you missing a using directive or an assembly reference?)
C:\Users\admin\Proj\project-7440\ActionLog\MainWindow.xaml.cs(27,18): error CS1061: 'ActionLog.MainWindow' does not contain a definition for 'AllContacts' and no extension method 'AllContacts' accepting a first argument of type 'ActionLog.MainWindow' could be found (are you missing a using directive or an assembly reference?)
C:\Users\admin\Proj\project-7440\ActionLog\MainWindow.xaml.cs(74,91): error CS1061: 'ActionLog.MainWindow' does not contain a definition for 'SearchBox' and no extension method 'SearchBox' accepting a first argument of type 'ActionLog.MainWindow' could be found (are you missing a using directive or an assembly reference?)
C:\Users\admin\Proj\project-7440\ActionLog\MainWindow.xaml.cs(89,13): error CS0103: The name 'ContactsList' does not exist in the current context
C:\Users\admin\Proj\project-7440\ActionLog\MainWindow.xaml.cs(97,17): error CS0103: The name 'ContactsList' does not exist in the current context
C:\Users\admin\Proj\project-7440\ActionLog\MainWindow.xaml.cs(121,13): error CS0103: The name 'ButtonClose' does not exist in the current context
C:\Users\admin\Proj\project-7440\ActionLog\MainWindow.xaml.cs(126,13): error CS0103: The name 'ButtonClose' does not exist in the current context
c:\Users\admin\Proj\project-7440\ActionLog\MainWindow.xaml(240,134): error CS1061: 'ActionLog1.MainWindow' does not contain a definition for 'Grid_MouseLeftButtonDown' and no extension method 'Grid_MouseLeftButtonDown' accepting a first argument of type 'ActionLog1.MainWindow' could be found (are you missing a using directive or an assembly reference?)
c:\Users\admin\Proj\project-7440\ActionLog\MainWindow.xaml(241,134): error CS1061: 'ActionLog1.MainWindow' does not contain a definition for 'Grid_MouseLeftButtonDown' and no extension method 'Grid_MouseLeftButtonDown' accepting a first argument of type 'ActionLog1.MainWindow' could be found (are you missing a using directive or an assembly reference?)
c:\Users\admin\Proj\project-7440\ActionLog\MainWindow.xaml(242,107): error CS1061: 'ActionLog1.MainWindow' does not contain a definition for 'ButtonClose_MouseLeftButtonDown' and no extension method 'ButtonClose_MouseLeftButtonDown' accepting a first argument of type 'ActionLog1.MainWindow' could be found (are you missing a using directive or an assembly reference?)
c:\Users\admin\Proj\project-7440\ActionLog\MainWindow.xaml(242,92): error CS1061: 'ActionLog1.MainWindow' does not contain a definition for 'ButtonClose_MouseEnter' and no extension method 'ButtonClose_MouseEnter' accepting a first argument of type 'ActionLog1.MainWindow' could be found (are you missing a using directive or an assembly reference?)
c:\Users\admin\Proj\project-7440\ActionLog\MainWindow.xaml(242,92): error CS1061: 'ActionLog1.MainWindow' does not contain a definition for 'ButtonClose_MouseLeave' and no extension method 'ButtonClose_MouseLeave' accepting a first argument of type 'ActionLog1.MainWindow' could be found (are you missing a using directive or an assembly reference?)
c:\Users\admin\Proj\project-7440\ActionLog\MainWindow.xaml(244,131): error CS1061: 'ActionLog1.MainWindow' does not contain a definition for 'Grid_MouseLeftButtonDown' and no extension method 'Grid_MouseLeftButtonDown' accepting a first argument of type 'ActionLog1.MainWindow' could be found (are you missing a using directive or an assembly reference?)
Compile complete -- 14 errors, 0 warnings

I'm not sure I exactly understand your situation, but here is a strategy to follow:
Before you start, though, make sure you back up your whole solution! (Or better yet, use version control.)
Work on your dependent project first:
Rename the project.
Go to Properties/Application and rename the "Assembly name" and "Default namespace" to match your project name.
Do a find/replace for your whole project, replacing all instances of your original namespace with your new namespace (use "whole words only" and "match case" to be safe).
Compile.
Now work on your GUI project:
Locate the reference to your original dependent project in the References folder and remove it.
Rename the project.
Go to Properties/Application and rename the "Assembly name" and "Default namespace" to match your project name.
Right-click the References folder and re-add the reference to your renamed dependent project.
Do two find/replace operations for your whole project:
The first should replace the namespace for your dependent project with the new namespace.
The second should replace the namespace for your GUI project with the new namespace.
Compile.

Related

Is missing a using directive or an assembly reference

I have a xamarin project that uses some components that are not recognized.
When I try to compile this project it gives the following error:
Error CS0246: The type or namespace name "UIKit" can not be found (is it missing a using directive or an assembly reference?)
Error CS0246: The name of the "CoreLocation" type or namespace can not be found (is it missing a using directive or an assembly reference?)
Anyone have any ideas to solve this?

Debugging Web Project w/ Visual Studio Code + ASP.NET 5 + Mono + Kestrel + OS X

I'm pretty new to OS X (4 days with my new mac), and I am working on setting up an environment where I can debug my Asp.Net 5 web project locally with the debugger built into Visual Studio Code, specifically getting the breakpoint to work when attaching to mono.
I followed these instructions for installing asp.net 5 and visual studio code. (http://docs.asp.net/en/latest/getting-started/installing-on-mac.html)
I then installed yeoman, and scaffolded out an aspnet project.
I ran commands dnu restore, dnu build, and dnx web.
The project runs locally on Kestrel at localhost:5000 just fine. I can also attach it to mono via the VS Code debugger.
The issue arises when I try to set breakpoints in the C# code. The debugger will not hit them.
After doing some research I found that I needed to specify the Startup.cs file to mono as the one to debug. (https://code.visualstudio.com/Docs/editor/debugging)
But after running mcs -debug Startup.cs, I get these errors:
Startup.cs(5,17): error CS0234: The type or namespace name `AspNet' does not exist in the namespace `Microsoft'. Are you missing an assembly reference?
Startup.cs(6,17): error CS0234: The type or namespace name `AspNet' does not exist in the namespace `Microsoft'. Are you missing an assembly reference?
Startup.cs(7,17): error CS0234: The type or namespace name `AspNet' does not exist in the namespace `Microsoft'. Are you missing an assembly reference?
Startup.cs(8,17): error CS0234: The type or namespace name `Data' does not exist in the namespace `Microsoft'. Are you missing an assembly reference?
Startup.cs(9,17): error CS0234: The type or namespace name `Extensions' does not exist in the namespace `Microsoft'. Are you missing an assembly reference?
Startup.cs(10,17): error CS0234: The type or namespace name `Extensions' does not exist in the namespace `Microsoft'. Are you missing an assembly reference?
Startup.cs(11,17): error CS0234: The type or namespace name `Extensions' does not exist in the namespace `Microsoft'. Are you missing an assembly reference?
Startup.cs(12,17): error CS0234: The type or namespace name `Extensions' does not exist in the namespace `Microsoft'. Are you missing an assembly reference?
Startup.cs(13,16): error CS0234: The type or namespace name `Models' does not exist in the namespace `palmtree'. Are you missing an assembly reference?
Startup.cs(14,16): error CS0234: The type or namespace name `Services' does not exist in the namespace `palmtree'. Are you missing an assembly reference?
Startup.cs(20,24): error CS0246: The type or namespace name `IHostingEnvironment' could not be found. Are you missing an assembly reference?
Startup.cs(20,49): error CS0246: The type or namespace name `IApplicationEnvironment' could not be found. Are you missing an assembly reference?
Startup.cs(39,16): error CS0246: The type or namespace name `IConfigurationRoot' could not be found. Are you missing an assembly reference?
Startup.cs(42,39): error CS0246: The type or namespace name `IServiceCollection' could not be found. Are you missing an assembly reference?
Startup.cs(62,31): error CS0246: The type or namespace name `IApplicationBuilder' could not be found. Are you missing an assembly reference?
Startup.cs(62,56): error CS0246: The type or namespace name `IHostingEnvironment' could not be found. Are you missing an assembly reference?
Startup.cs(62,81): error CS0246: The type or namespace name `ILoggerFactory' could not be found. Are you missing an assembly reference?
It looks like mono cannot debug compile the Startup.cs properly. Is anyone else getting this error when trying to set up debugging? Or does anyone have breakpoints working with mono, asp.net 5, kestrel, vs code, and OS X?
Debugging Visual Studio Code and ASP.NET 5 are in preview and at this
time debugging ASP.NET 5 is not supported in Visual Studio Code (on
any platform). Rest assured, we are working hard to bring these
experiences to you in the near future.
Ref: https://code.visualstudio.com/docs/runtimes/ASPnet5
The Mono section that you are referring to is for compiling and attaching to a mono/.Net program (not an dnx ASP.NET-based one). ASP.NET 5 applications are compiled using the Roslyn compiler, not Mono's mcs.
Debugging a Mono Application Example:
Create a directory, cd into it and type code . to start VSCode using that directory.
mkdir monoconsoletest
cd monoconsoletest
code .
Create a new file in VSCode
Name it program.cs
Enter the following code into the editor:
using System;
namespace consoleViaVSCode
{
class MainClass
{
public static void Main (string[] args)
{
Console.WriteLine ("Hello VSCode!");
}
}
}
You could compile and run this in a shell, but let create a tasks.json file so we can do it via the Command Palette.
Create a tasks.json file:
The next step is to set up the task configuration. To do this open the Command Palette with F1 and type in Configure Task Runner, press Enter to select it.
This will create a sample tasks.json file in the .vscode folder. The initial file has a large number of examples within it. Highlight it all, delete it and add:
{
"version": "0.1.0",
"command": "mcs",
"isShellCommand": true,
"showOutput": "silent",
"args": ["-debug", "program.cs"]
}
Now you have one task that you can execute via task mcs down the Command Palette and this task will build your program.cs using Mono's mcs compiler with the '-debug' option that will create a program.exe.mdb file that has the debugging symbols for the program.exe application.
So execute that task and if you have no errors, a program.exe and program.exe.mdb` will show up in the file pane:
If you have any errors, they will show up in the Output pane (right of the source code pane).
Now lets add a task to run your program with mono .Net runtime with the options for it to wait for a debugger to attach.
Note: I would show you a mono debugger task but running a shell process like that is broken in VSC 0.10.1. and you would be to wrap it in a glup routine... :-/ so...
In the process.cs, set a break point on the Console.Write.... line:
From the shell that you started VSCode from:
mono --debug --debugger-agent=transport=dt_socket,server=y,address=127.0.0.1:5858 program.exe
Back in VSCode:
Click the Bug Icon and than the Config\Gear Icon and select "C# mono" to generate the default "attach" configuration. Select "Attach" and click green Start button:
And you will hit your breakpoint:

Unity3D error CS0246: The type or namespace name could not be found (are you missing a using directive or an assembly reference?)

This is the errors when i build my game for Universal Windows 10 (Unity3D)
Unity3D error CS0246: The type or namespace name could not be found
(are you missing a using directive or an assembly reference
My Question is Unique because it has different Compiler Errors.

Xamarin - using xbuild to build a project with xamarin componenet added

Xbuild [Xamarin Studio] on mac os x
I am trying to build a solution & (Visual studio project file) csproj using xbuild.
This solution holds a project - which is not the startup project and which has a reference to Newtonsoft [Added using xamarin component] Please note the component is marked as "Included in this Project."
The solution and the project build fine in Xamarin, however on deleting the entire solution and their files. Now using team city to download the project and then use Xbuild to build the same the solution and the project both fail wih the following error message :
I have appended a snapshot of the error message
[18:01:48] [Step 3/4] ../../../../NESQuestionFramework/NESQuestionFramework/Model/Evidence/EvidenceNotRequired.cs(1,7): error CS0246: The type or namespace name `Newtonsoft' could not be found. Are you missing an assembly reference?
[18:01:48] [Step 3/4] ../../../../NESQuestionFramework/NESQuestionFramework/Model/Evidence/PhotoEvidence.cs(1,7): error CS0246: The type or namespace name `Newtonsoft' could not be found. Are you missing an assembly reference?
[18:01:48] [Step 3/4] ../../../../NESQuestionFramework/NESQuestionFramework/Model/Evidence/TextEvidence.cs(1,7): error CS0246: The type or namespace name `Newtonsoft' could not be found. Are you missing an assembly reference?
[18:01:48] [Step 3/4] ../../../../NESQuestionFramework/NESQuestionFramework/Model/Questions/BoundedQuestion.cs(3,7): error CS0246: The type or namespace name `Newtonsoft' could not be found. Are you missing an assembly reference?
[18:01:48] [Step 3/4] ../../../../NESQuestionFramework/NESQuestionFramework/Model/Questions/ExtendedInfoQuestion.cs(11,7): error CS0246: The type or namespace name `Newtonsoft' could not be found. Are you missing an assembly reference?
[18:01:48] [Step 3/4] ../../../../NESQuestionFramework/NESQuestionFramework/Model/Questions/InfoItem.cs(4,7): error CS0246: The type or namespace name `Newtonsoft' could not be found. Are you missing an assembly reference?
[18:01:48] [Step 3/4] ../../../../NESQuestionFramework/NESQuestionFramework/Model/Questions/MultiResponseQuestion.cs(11,7): error CS0246: The type or namespace name `Newtonsoft' could not be found. Are you missing an assembly reference?
[18:01:48] [Step 3/4] ../../../../NESQuestionFramework/NESQuestionFramework/Model/Questions/Question.cs(11,7): error CS0246: The type or namespace name `Newtonsoft' could not be found. Are you missing an assembly reference?
[18:01:48] [Step 3/4] ../../../../NESQuestionFramework/NESQuestionFramework/Model/Questions/QuestionSet.cs(2,7): error CS0246: The type or namespace name `Newtonsoft' could not be found. Are you missing an assembly reference?
Xbuild does try and ValidateAndroidPackage path however it cannot locate the Newtonsoft.Json package.
Target _ValidateAndroidPackageProperties:
GetAndroidPackageName Task
ManifestFile:
AssemblyName: NESQuestionFramework
PackageName: NESQuestionFramework.NESQuestionFramework
Target _AndroidResolveAssemblyReferences:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: warning : Reference 'Newtonsoft.Json' not resolved
For searchpath {CandidateAssemblyFiles}
Warning: {CandidateAssemblyFiles} not supported currently
For searchpath {HintPathFromItem}
Considered ../../Components/json.net-4.5.11/lib/android/Newtonsoft.Json.dll, but it does not exist.
For searchpath {TargetFrameworkDirectory}
Considered target framework dir /Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v4.0.3, assembly named 'Newtonsoft.Json' not found.
Considered target framework dir /Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0, assembly named 'Newtonsoft.Json' not found.
Considered target framework dir /Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/Facades/, assembly named 'Newtonsoft.Json' not found.
For searchpath {PkgConfig}
Considered Newtonsoft.Json, but could not find in any pkg-config files.
For searchpath {GAC}
Considered Newtonsoft.Json, but could not find in the GAC.
For searchpath {RawFileName}
Considered '/Users/admin/Downloads/TeamCity/buildAgent/work/b998b8d1d0b0ff61/NESTouch/NESTouch.Android/NESQuestionFramework.Android/NESQuestionFramework.Android/Newtonsoft.Json' as a file, but the file does not exist
For searchpath bin/Debug/
Considered '/Users/admin/Downloads/TeamCity/buildAgent/work/b998b8d1d0b0ff61/NESTouch/NESTouch.Android/NESQuestionFramework.Android/NESQuestionFramework.Android/bin/Debug/Newtonsoft.Json' as a file, but the file does not exist
Considered '/Users/admin/Downloads/TeamCity/buildAgent/work/b998b8d1d0b0ff61/NESTouch/NESTouch.Android/NESQuestionFramework.Android/NESQuestionFramework.Android/bin/Debug/Newtonsoft.Json.exe' as a file, but the file does not exist
Considered '/Users/admin/Downloads/TeamCity/buildAgent/work/b998b8d1d0b0ff61/NESTouch/NESTouch.Android/NESQuestionFramework.Android/NESQuestionFramework.Android/bin/Debug/Newtonsoft.Json.dll' as a file, but the file does not exist
What would be the correct approach to sort out this problem.
Currently I am forcing the developers to log onto the server and manually build the solution using xamarin studio [which I believe does download Newtonsoft] and run it every subsequent time using xbuild.
Many thanks for your time
Rajesh
This is a bit old, but we are using json.net (newtonsoft) from nuget
which allows to easily run nuget restore on the solution.
as a work around you can run mdtool from the xamarin studio which worked fine (has some limitations)

ASP.NET MVC 3 Project will not compile on build server with ASP.NET MVC 3 installed

I'm having an odd problem on my build server. I'm using the latest version of TeamCity on Windows Server 2008 R2. I used the web platform installer to install ASP.NET MVC on the build server but, my compilation is still failing with messages that it cannot find the System.Web.Mvc.dll. I've verified that it is on the disk at the expected location:
(C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies)
Here is a selection of the messages:
Controllers\AccountController.cs(7, 18): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
Controllers\AccountController.cs(15, 35): error CS0246: The type or namespace name 'Controller' could not be found (are you missing a using directive or an assembly reference?)
Controllers\HomeController.cs(5, 18): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
Controllers\HomeController.cs(9, 32): error CS0246: The type or namespace name 'Controller' could not be found (are you missing a using directive or an assembly reference?)
Global.asax.cs(5, 18): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
Models\AccountModels.cs(8, 18): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
So what am I missing?
The errors you seem to be inferring that it can't find the correct version of the MVC dll. Is it possible you've installed the MVC (original) or MVC2 instead of the MVC3 from the web platform onto the build server?
Edit:
Also the file should be in the GAC, (not sure the location on Win Server 2008 but guessing it's similar to Win 7.)
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Web.Mvc\ (then the .Net version folder, mine is v4.0_3.0.0.0)

Resources