My Software Notes

Useful things I discover

Archive for the ‘Visual Studio’ Category

Forcing Visual Studio to produce an XML Serializers DLL

leave a comment »

A friend needed the Xml Serializers dll, the one named something like “ClassLibrary1.XmlSerializers.dll”, so he went into the project properties in VS and set “Build > Generate serialization assembly” to “On”.  But nothing happened.  No XmlSerializers dll was created.

We hunted round for an answer and came across this: Generating an Xml Serialization assembly as part of my build.

Quick answer:

After setting the above project property you must go into the project file in your favorite text editor and add this:

<SGenUseProxyTypes>false</SGenUseProxyTypes>

 

just after the line:

<GenerateSerializationAssemblies>On</GenerateSerializationAssemblies>

 

You should end up with something like this:

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <GenerateSerializationAssemblies>On</GenerateSerializationAssemblies>
    <SGenUseProxyTypes>false</SGenUseProxyTypes>
  </PropertyGroup>

 

Do that for every build configuration where you need the serializer.

Hope that helps.

Advertisements

Written by gsdwriter

July 28, 2014 at 11:39 am

“Unable to attach to process. A debugger is already attached.” (VS 2010, Classic ASP)

with 2 comments

Situation:

A fellow developer was using Visual Studio 2010 SP1 to debug a classic ASP application.  He attempted to attach to the IIS process, w3wp.exe and received the error message: “Unable to attach to process. A debugger is already attached.”

Data:

He is running Windows 7, 32 bit. (But I reproduced the error on Win7 64 bit.)

He is using IIS 7.5.

Yesterday he installed IE 10 32 bit. (Yesterday I installed IE 10 64 bit.)

We looked in Process Explorer but no debugger was running that we could see.

We tried changing the “Attach to” type in the “Attach to Process” dialog, but it had no effect.

We tried all sorts of things but nothing made any difference.

I found this forum article:  Visual Studio 2010 debugger already attached classic ASP

I tried debugging the same ASP site by attaching to the IIS process, using VS 2012 and it worked perfectly.

Solution:

Use VS 2012 or revert from IE 10 for Win7 to IE 9.

 

My fellow developer is installing VS 2012. (I don’t know why he didn’t do it already – heck, it’s worth it just for that cool Dark Theme.)

I hope that helps anyone hitting this issue.

Written by gsdwriter

March 1, 2013 at 1:36 pm

Adding PowerShell Automation to a .NET Application

with 3 comments

So I want to add PowerShell automation to my .NET app and according to MSDN (How to Write a Simple Host Application) I have to use the “Browse” feature of the “Add Reference” dialog in Visual Studio.  The location for the System.Management.Automation.dll is given as “Windows\assembly\GAC_MSIL\System.Management.Automation”.  But that may not always be correct.  See my note at the end.

Another, and I think better, way to do it is to open your project file and in the first “<ItemGroup>” section, add:

    <Reference Include="System.Management.Automation" />

This worked great for me.

Something to watch out for if you use the “Browse” method and you are using the Powershell 3 CTP: The dll is in a different location:

C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Management.Automation\v4.0_3.0.0.0__31bf3856ad364e35

When I used the “Reference” method, Visual Studio referenced it without me having to do anything more.  Now that’s what I call service.

Written by gsdwriter

August 28, 2012 at 3:46 pm

Posted in .NET, Powershell, Visual Studio

Tagged with ,

Can’t upgrade NuGet in Visual Studio 2010 SP1

leave a comment »

I’ve been able to upgraded NuGet successfully sometimes and other times I’ve had to uninstall and reinstall to make it work. Very annoying.

Today it happened again and looking in the intallation log I saw: “The signature on the update version of ‘NuGet Package Manager’ does not match the signature on the installed version”.

I hunted around and found the solution: Install this VS hotfix – http://bit.ly/vsixcertfix

See “Known Installation Issue” at http://docs.nuget.org/docs/release-notes/nuget-1.8

Thanks to http://www.codeplex.com/site/users/view/pranavkm for the post that led me to this.

Written by gsdwriter

June 5, 2012 at 2:58 pm

Posted in Visual Studio