views:

560

answers:

1

I'm currently getting an error trying to resolve my IDataAccess class.

The value of the property 'type' cannot be parsed. The error is: Could not load file or assembly 'TestProject' or one of its dependencies. The system cannot find the file specified. (C:\Source\TestIoC\src\TestIoC\TestProject\bin\Debug\TestProject.vshost.exe.config line 14)

This is inside a WPF Application project.

What is the correct syntax to refer to the Assembly you are currently in? is there a way to do this? I know in a larger solution I would be pulling Types from seperate assemblies so this might not be an issue. But what is the right way to do this for a small self-contained test project. Note: I'm only interested in doing the XML config at this time, not the C# (in code) config.

UPDATE: see all comments

My XML config:

<configuration>
  <configSections>
    <section name="unity" type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection, Microsoft.Practices.Unity.Configuration" />
  </configSections>
  <unity>
    <typeAliases>
      <!-- Lifetime manager types -->
      <typeAlias alias="singleton"  type="Microsoft.Practices.Unity.ContainerControlledLifetimeManager, Microsoft.Practices.Unity" />
      <typeAlias alias="external" type="Microsoft.Practices.Unity.ExternallyControlledLifetimeManager, Microsoft.Practices.Unity" />
      <typeAlias alias="IDataAccess" type="TestProject.IDataAccess, TestProject" />
      <typeAlias alias="DataAccess" type="TestProject.DataAccess, TestProject" />
    </typeAliases>
    <containers>
      <container name="Services">
        <types>
          <type type="IDataAccess" mapTo="DataAccess" />
        </types>
      </container>
    </containers>
  </unity>
</configuration>
A: 

This looks fine. Are you sure your assembly name is correct? Check the project preferences to make sure the name of your assembly is correct:

  1. Right click your project and click Properties
  2. Click on the Application tab on the left
  3. Look at the value of the "Assembly Name" field.

Sometimes if you've renamed your project, this field will still be the old value.

It's possible that this is not the issue at all, but it is the simplest thing to check. If you find that this is not the issue, reply to this and I'll post any other ideas I have.

Also, you might consider posting your sample as a .zip file so we can take a look at it.

Anderson Imes
One problem is the app project is TestProject, but when Visual Studio is running it in debug it runs it as TestProject.vhost.exe. I added the vhost into name in the XML file and this did not help.
tyndall
I can't upload the sample because in order to not be paralyzed by this issue, I split the code into two assemblies so I could just keep moving forward. One class library project and one WPF project.
tyndall
The name of the DLL and the name of the assembly have nothing to do with each other. This is why I asked you to interrogate the name of the assembly.
Anderson Imes
Oh. The assembly name was the same though.
tyndall
Turn on Fusion Logging, then. You've likely got something that you are referencing from *that* DLL that isn't available. The application to do that is FusLogVw.exe
Anderson Imes