How to Configure Test Deployment with the file LocalTestRun.testrunconfig? - asp.net

First of all sorry if the question is not very clear.
I am learning nHibernate from the summerofnhibernate.com, in the first chapter when I run a test project, I get the following error: Test method TestProject1.NHibernateDataProviderTestTest.CanGetCustomerByIdTest threw exception: NHibernate.HibernateException: problem parsing configuration : System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PublicAssemblies;PrivateAssemblies\hibernate.cfg.xml'.
I have googled the problem, and the search says that the VS 2008 path is wrong(buggy), to place hibernate.cfg.xml in test project and adding the attribute: [TestMethod(), DeploymentItem("hibernate.cfg.xml")]
After having done this I still get the same problem.
But when I use Visual Studio 2010 I get the following error:
Test method TestProject1.NHibernateDataProviderTestTest.CanGetCustomerByIdTest threw exception:
System.NullReferenceException: Object reference not set to an instance of an object.

looks like 2 different problems.
For the first place nhibernate.cfg.xml in the Project and give the path to new Configuration("Path to hibernate.cfg.xml") somewhere in the testsetup.
The Second looks like the getmethod returns null because it cant finde the Customer with given id in the database. If you use SQLite inMemory a typical captcha is, that each new Connection points to a different Database -> Open Sessions with sf.OpenSession(theOneConnection) or Session.Clear() instead of creating a new one.
Hope it helps

Basically , (depends on your question : How to Configure Test Deployment with the file LocalTestRun.testrunconfig?)
Here is the way that you can follow:
To select files or folders to deploy, in run configuration
In Solution Explorer, under Solution Items, double-click the run configuration file that you want to edit.
A dialog box that has a name such as .testrunconfig appears.
Click Deployment.
Under Additional files or directories to deploy, specify additional files or folders to be copied.
To do this,
click Add file to select files; this opens the Add Deployment Files dialog box.
You can also click Add Directory to select folders by using the Add Deployment Directory dialog box.
In the .testrunconfig dialog box, click Save and then click OK.
These deployment items will be copied to the deployment folder whenever this run configuration file is active.
Hope this will help.

Related

Circular file references are not allowed Dnn 7+ in TFS 2013

I am using DNN 7.3 for a website project which is a combination of VB and C# codes. I use visual studio 2013 to build the project.
If the MSBuid Option in property page is configured to Allow this Precompiled site to be updatable and the project is published.
There will be a successful built. But when it is checked in to the TFS, the following exception will be thrown:
/compiled/DesktopModules/Admin/Security/manageusers.ascx (8): Circular file references are not allowed.
/compiled/DesktopModules/Admin/Security/manageusers.ascx (67): Unknown server tag 'dnn:profile'.
/compiled/DesktopModules/Admin/Security/EditUser.ascx (5): Circular file references are not allowed.
/compiled/DesktopModules/Admin/Security/EditUser.ascx (163): Unknown server tag 'dnn:Profile'.
/compiled/admin/Users/ViewProfile.ascx (4): Unknown server tag 'dnn:Profile'.
Also, when I checked Use Fixed Naming and Single Page Assemblies together with the Allow this Precompiled site to be updatable. it will throw:
ASPNETCOMPILER: Object reference not set to an instance of an object.
when I searched online, I was given two options from this blog.
I have tried the two but still having the same error.
I don't know what I am doing wrong.
Please look at [here] (http://ellisweb.net/2009/12/fixing-the-circular-file-references-are-not-allowed-error-in-asp-net/) for the explanation why you would see this error, simply speaking, if you have the following setup:
/folder1/Control1.ascx > References Control2
/folder2/Control2.ascx > References Control3
/folder1/Control3.ascx
This means that the folder1 dll will reference the folder2 dll which will again reference the folder1 dll, causing a “circular file reference”.
The solution is try to rearrange all controls under each folders, sometimes, you have to make a problem user control copied over to multiple folders to prevent such circular calling.
I changed The Clean WorkSpace property of TFS Build Process Parameters to false.
The error just disappeared and I was able to build successfully into TFS Drop folder. I don't know why this solves the problem but the problem was resolved.

Unable to create the workspace '' due to a mapping conflict

I am using TFS 2013 Build Server.
Getting the following Error
Exception Message: Unable to create the workspace '' due to a mapping conflict. You may need to manually delete an old workspace. You can get a list of workspaces on a computer with the command 'tf workspaces /computer:%COMPUTERNAME%'.
Details: The path F:\GDC\Bin is already mapped in workspace ''. (type MappingConflictException)
I have multiple build Definition which refers to common binary folder
Source Setting for Build definition BD1
Source Control Folder Build Agentfolder
$/Common F:\GDC\Bin
$/Project1 $(SourceDir)
Source Setting for Build defination BD2
Source Control Folder Build Agentfolder
$/Common F:\GDC\Bin
$/Project2 $(SourceDir)
Source Setting for Build definition BD3
Source Control Folder Build Agentfolder
$/Common F:\GDC\Bin
$/Project3 $(SourceDir)
This occurs (as the error suggests) when you have a workspace clash on the build server. Workspaces are saved as configuration values in the TFS database so clashes are possibly caused by:
you have created a new build definition with the same name as a previous build definition.
some part of your workspace name (or an artifact within your project) is over 260 chars
build definition is not using $(sourcedir) macro in System Settings tab
More details are explained in this article
Work-around:
Rename your build definition to something unique.
Here is how I did it:
First, tried to list the workspaces on the server in question. I tried through both Visual Studio UI and command prompt: tf workspaces /computer:. The workspace that is mentioned in the Exception message did not show up in the list.
Downloaded and installed Team Foundation Sidekicks 2015 from http://www.attrice.info/downloads/
When the app installed, opened and connected to tfs server.
Selected the computer name from the dropdown, cleared the Owner name (VERY IMPORTANT!) dropdown from the dropdown and changed Last access date to a date few years ago.
Clicked Search button. The list of workspaces appeared. This time I could see the workspace that was mentioned in the Exception message.
Selected the workspace that is mentioned in the Exception message and clicked Delete button.
It appears that when I login to the build server and ask for the workspaces list, tfs only shows me the workspaces of which I am the owner. The temporary workspaces that build process creates were not assigned to me and therefore I could not see them. Team Foundation Sidekicks 2015 did show me all of the workspaces.
Note: I used TFS2015 in this exercise.
So you have a Workspace conflict.
The easiest way to explain to fix this is to delete your workspaces and make them over again.
You'll need to use the TF tool.
TF /workspace /delete....
There is a TFS sidekicks tool that should be able to do this for you with a GUI.
http://www.attrice.info/cm/tfs/
The reason was (for me) that I have cloned the build definitions. So every "Build Agend Folder" in Source Settings points to the same target folder.
Solution was to change the Build Agent Folder to something special for each build.
e.g. $(SourceDir)\project1
$(SourceDir)\project2 etc
I had the same problem. My solution was that in Edit Build Definition > Source Settings, a Build Agent Folder was not prefixed with $(SourceDir), but instead the full path on my local machine.
I changed the path to be prefixed with $(SourceDir, and my problem was solved.
I have rename build definition name and it started working.

Transform web.config on azure

The question is a follow up to this one: Generate Web.Debug config which could be debugged](Generate Web.Debug.config which could be debugged)
I have defined a transformation for web.debug.config. During compilation I see the following:
Transformed Web.config using C:\data\Main\WebRole\Web.Debug.config into
C:\data\Main\obj\obj\x64\Debug\WebRole.csproj\TransformWebConfig\ [...]
transformed\Web.config.
Checked Web.config in the specified location - it is correct (transformation succeeded)
But when I start the service in the azure emulator I get an alert that
Why does it happen? Looks that incorrect web.config is taken. Where should I specify the location of correct (transformed) file?
The key thing to realise with web.config Transforms (and is mentioned in the answer to your linked question) is that they are only part of the story.
When you build your sources, the transformed web.config file is built into the /obj/ folder, ready for deployment.
It is only the act of deploying your solution somewhere that puts the transformed config file into use - as noted in the docs:
When you deploy the Web application by using the selected build configuration and by using either a deployment package or one-click publish, the Web.config file is transformed according to your specifications.
How are you running the application after you build it? You need to publish or deploy it using one of the built in mechanisms that support web transforms to see those changes on your site.
If you are running the emulator against the original source files, they won't see the transformed web.config file - which is why typically the debug build doesn't have any transforms and you then turn off debugging with your Release build which is then deployed to production.
As you're trying to test this in the emulator you should be able to do the following:
In the Solution Explorer, ensure you've selected a file within the project that runs in the emulator.
From the Build menu, select "Publish [Project Name".
In the Publish Wizard, create a new "Profile" using the "Custom" publish target.
In the "Connection" pane select "File System" as the publish method, and give it a suitable target location.
In the "Settings" pane choose the appropriate configuration (in your case probably "Debug"), and set any other options that you'd like.
Then press "Publish", and the project should be built, and then deployed to the new file location.
You should then be able to start the emulator from this newly published location, which will be using your transformed web.config.
I have found this solution and it works perfectly
https://translate.google.co.il/translate?hl=en&sl=de&tl=en&u=http%3A%2F%2Fwww.sascha-dittmann.de%2Fpost%2FWebConfig-Transformation-im-Windows-Azure-Compute-Emulator.aspx&anno=2

asp.net error “The type 'typeName' exists in both ”temp1.dll“ and ”temp2.dll"

When I build a web site I haven't got errors, but when I try to publish site the error appears:
Type 'AttachmentsControl' exists in both в 'c:\Users\userName\AppData\Local\Temp\Temporary ASP.NET Files\web.ui.application\8c85983a\5425041a\App_Web_mivbsgll.dll' and 'c:\Users\userName\AppData\Local\Temp\Temporary ASP.NET Files\web.ui.application\8c85983a\5425041a\App_Web_dhvduebi.dll'
I tried to add the batch="false" attribute to the "compilation" element of the web.config file, but this didn't help.
Also I tried to rename one class, but in this case another error appears:
Server Error in '/projectName' Application.
Thread was being aborted.
Can anybody help me?
P.S.: the most strangest thing is that I get this project from MS TFS, my colleague who add this project to TFS publish this site without errors.
Most probably the reason could be you are uploading the source files along with compiled published output and at the same time the source files are modified.
When you see this error, what asp.net is trying to do is, compile the files and create the application and the result is, you have two type declaration of same name, one in the dll and one in the source.
Try to delete the dll file you have uploaded (from the bin directory), it should resolve the issue.

What is the process involved in viewing a webservice in a browser from within visual studio?

I have created a new VS2008 ASP.Net Web service project, with the default name WebService1. If I right click on the Service1.asmx file and select 'View in Browser' what are the processes that go on to make this happen? I am asking because I have a situation where when I run this from a visual studio project started in our development shell (which sets up a common build environment) I cannot get the web service to show up in the browser.
It starts the asp.net development server and creates a single file:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\c43ddc22\268ae91b\hash\hash.web
but when I start it from a stand alone project i get a whole slew of files in here:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\edad4eee\d198cf0e\App_Web_defaultwsdlhelpgenerator.aspx.cdcab7d2.vicgkf94.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\edad4eee\d198cf0e\service1.asmx.cdcab7d2.compiled
etc etc
I am trying to debug this but not really getting anywhere. i have inspected the output from VS but the only option I get is for the build output, which is basic and doesn't really contain any information that is useful. I have tried running both versions with DebugView running but no output there either.
I would like to know if there are any log files I could look at, or if anyone has any suggestions on how I might be able to debug what is going wrong here?
For completeness the output I get when it doesn't work is:
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not create type 'WebService1.Service1'.
Source Error:
Line 1:
Source File: /Service1.asmx Line: 1
Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3082
Ok, not sure that its perfect but I found a resolution to this issue. the problems seems to be that the development shell redirects the <OutputPath> of the projects visual studio is building, and this was causing problems as, although the dependencies of the web service project were being copied into the $(ProjectDir)Bin\ directory, the actual webservice dll itself was not. The solution (workaround?) seems to be to add this to the post build event command line:
xcopy /y "$(TargetPath)" "$(ProjectDir)Bin\"
Then i am able to right click on the .asmx file and select view in browser and everything works as expected.
Hope this might help someone else in the future. or maybe even me in another place and time.

Resources